More
Blog
Series
Projects
About
Leetcode Practice

LC 1071. Greatest Common Divisor of Strings

Last updated
March 17, 2024
Reading time
1 min read
  • Back to start


  • 1. Two Sum


  • 2. Add Two Numbers


  • 3. Longest Substring Without Repeating Characters


  • 7. Reverse Integer


  • 9. Palindrome Number


  • 13. Roman to Integer


  • 15. 3Sum


  • 20. Valid Parentheses


  • 22. Generate Parentheses


  • 36. Valid Sudoku


  • 49. Group Anagrams


  • 84. Largest Rectangle in Histogram


  • 88. Merge Sorted Array


  • 125. Valid Palindrome


  • 150. Evaluate Reverse Polish Notation


  • 151. Min Stack


  • 217. Contains Duplicate


  • 238. Product of Array Except Self


  • 242. Valid Anagram


  • 347. Top K Frequent Elements


  • 424. Longest Repeating Character Replacement


  • 496. Next Greater Element I


  • 503. Next Greater Element II


  • 704. Binary Search


  • 739. Daily Temperatures


  • 853. Car Fleet


  • 875. Koko Eating Bananas


  • 901. Online Stock Span


  • 1431. Kids with the Greatest Number of Candies


  • 1475. Final Prices with a Special Discount in a Shop


  • 1832. Check if the Sentence in Pangram


  • 2582. Pass the Pillow

The problem

Solution - O(n)O(n)O(n) Time

function kidsWithCandies(candies: number[], extraCandies: number): boolean[] {
  const max = Math.max(...candies)
  let answer: boolean[] = []
  for (let candy of candies) {
    answer.push(candy + extraCandies >= max)
  }
  return answer
}
Previous901. Online Stock Span
Next1475. Final Prices with a Special Discount in a Shop
githubfacebookyoutubelinkedintwitter
Hunter Faulkner
•
© 2025
•
Phantom Draught
Yokai icons created by Freepik • Flaticon