Intro to Dynamic Programming - Problem 2771Description You are given two 0-indexed integer arrays nums1 and nums2 of length n. Let's define another 0-indexed integer array, nums3, of length n. For each index i in the range [0, n - 1], you can assign either nums1[i] or nums2[i] to nums3[i]. Yo...Jun 30, 2025·5 min read
Problem 905. Sort Array by ParityDescription Given an integer array nums, move all the even integers at the beginning of the array followed by all the odd integers. Return any array that satisfies this condition. First Solution [Time: O(n), Space: O(n)] def sortArrayByParity(self, n...Jun 24, 2025·2 min read
Problem 20. Valid ParenthesesDescription Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: Open brackets must be closed by the same type of brackets. Open brackets must be close...Jun 22, 2025·1 min read
Problem 318. Maximum Product of Word Lengths [Medium] - Intro to BitmaskingDescription Given a string array words, return the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. If no such two words exist, return 0. Initial Attempt My initial attempts were at trying to see if ...Jun 22, 2025·3 min read
Problem 74. Search a 2D Matrix [Medium]Description You are given an m x n integer matrix matrix with the following two properties: Each row is sorted in non-decreasing order. The first integer of each row is greater than the last integer of the previous row. Given an integer target, r...Jun 20, 2025·1 min read
Depth First Search (DFS)In a Nutshell Typically used on graphs or trees represented as adjacency lists or hash maps. Explores a tree/graph data structure as deep as possible before backtracking. Useful when you want to check if a path exists, not necessarily the shortest...Jun 20, 2025·4 min read
Problem 283. Move Zeroes [Easy]Description Given an integer array nums, write an algorithm to move all 0’s to the end of the array while maintaining the relative order of the non-zero elements. You must do this in-place without making a copy of the array. My First Attempt [Time: O...Jun 20, 2025·2 min read