Category: Uncategorised
LeetCode – Array of Doubled Pairs
Link: https://leetcode.com/problems/array-of-doubled-pairs/
Continue readingLeetCode – Longest Mountain in Array
Link: https://leetcode.com/problems/longest-mountain-in-array/ Solution 1: find peak go left to find the increasing start index go right to find
Continue readingLeetCode – Valid Mountain Array
Link: https://leetcode.com/problems/valid-mountain-array/ Solution 1 – Walking from left and right: walking the mountain from left – increment l
Continue readingLeetCode – Rotate Array
Solution 1 (in place):
Continue readingLeetCode – Sort Array By Parity
Link: https://leetcode.com/problems/sort-array-by-parity/ Solution: The evenIndex variable literally keeps track of where the next even number should be. We
Continue readingLeetCode – Shuffle the Array
Link: https://leetcode.com/problems/shuffle-the-array/ Solution: iterate n times (half size of the array) each iteration will add a pair (x1,
Continue readingLeetCode – XOR Operation in an Array
Link: https://leetcode.com/problems/xor-operation-in-an-array/ Solution: Even if the problem mentions to build an array, we don’t really need one as
Continue readingLeetCode – Merge Sorted Array
Link: https://leetcode.com/problems/merge-sorted-array/ Solution: We know that both lists are already sorted, so we will use m and n
Continue reading