LeetCode içerisinde bulunan “Climbing Stairs”‘ sorusunun açıklaması ve çözümü. Bu soruda N basamaktan oluşan bir merdivenimiz var ve bu merdiveni çıkarken ya 1 basamak, ya da 2 basamak çıkabiliyoruz tek adımda. Bu merdiveni kaç farklı şekilde tırmanabiliriz? Leetcode’a göre Amazon ve Goldman Sachs’ta mülakatlarında sorulmuş sorulardan biri.
LeetCode içerisinde bulunan “Sqrt(x)”‘ sorusunun açıklaması ve çözümü. Bu soruda tamsayı bir parametre alan metodunuzdan geriye o sayının karekökünün tam sayı halini döndürmenizi istiyor. Tabi bunun için hali hazırda kullandığınız programlama dilinde var olan sqrt() gibi metodları kullanmamanız gerekmekte.
LeetCode içerisinde bulunan “Add Binary”‘ sorusunun açıklaması ve çözümü. Klasik ilkokulda toplama işlemini nasıl yapıyorsak alt alta, bu soruda da bu istenmiş. En önemli kısmı “elde” hesaplaması gibi görünüyor. LeetCode’a göre Facebook mülakatlarında sorulmuş sorulardan biri.
The count-and-say sequence is the sequence of integers with the first five terms as following:
1. 1
2. 11
3. 21
4. 1211
5. 111221
1 is read off as “one 1” or 11.
11 is read off as “two 1s” or 21.
21 is read off as “one 2, then one 1” or 1211.
Given an integer n where 1 ≤ n ≤ 30, generate the nth term of the count-and-say sequence. You can do so recursively, in other words from the previous member read off the digits, counting the number of digits in groups of the same digit.
☢️ Note: Each term of the sequence of integers will be represented as a string.
Example 1:
Input: 1
Output: “1”
Explanation: This is the base case.
Example 2:
Input: 4
Output: “1211”
Explanation:
For n = 3 the term was “21” in which we have two groups “2” and “1”, “2” can be read as “12” which means frequency = 1 and value = 2, the same way “1” is read as “11”, so the answer is the concatenation of “12” and “11” which is “1211”.
✔️ LeetCode içerisinde bulunan “Length of Last Word”‘ sorusunun açıklaması ve çözümü.
🔥 LeetCode 58. Length of Last Word: https://leetcode.com/problems/length-of-last-word/
➡️ Problem açıklaması:
Given a string s consists of upper/lower-case alphabets and empty space characters ‘ ‘, return the length of last word (last word means the last appearing word if we loop from left to right) in the string. If the last word does not exist, return 0.
Note: A word is defined as a maximal substring consisting of non-space characters only.
LeetCode içerisinde bulunan “Plus One”‘ sorusunun açıklaması ve çözümü. Bu soruda bir tamsayı dizi olarak verilen dizi elemanlarının temsil ettiği tamsayı değerinin bir fazlasını yine bir tamsayı dizisi olarak geri döndürmemiz isteniyor. LeetCod’ea göre bu soru Google ve eBay mülakatlarında sorulmuş sorulardan biri.
🔥 LeetCode 66. Plus One: https://leetcode.com/problems/plus-one/
➡️ Problem açıklaması:
Given a non-empty array of digits representing a non-negative integer, plus one to the integer.
The digits are stored such that the most significant digit is at the head of the list, and each element in the array contain a single digit.
You may assume the integer does not contain any leading zero, except the number 0 itself.
Example 1:
Input: [1,2,3]
Output: [1,2,4]
Explanation: The array represents the integer 123.
Example 2:
Input: [4,3,2,1]
Output: [4,3,2,2]
Explanation: The array represents the integer 4321.
LeetCode’un mayıs ayı için her gün bir programlama sorusu sorduğu “May Challenge”‘ın sekizinci gün sorusu “Check If It Is a Straight Line””ın açıklaması ve çözümü.
🔥 LeetCode May Challenge: https://leetcode.com/explore/featured/card/may-leetcoding-challenge
➡️ Problem açıklaması:
You are given an array coordinates, coordinates[i] = [x, y], where [x, y] represents the coordinate of a point. Check if these points make a straight line in the XY plane.