This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| To handle this leetcode question, I worked on an iterative solution. | |
| - Reversed the initial array (the rust baseline didn't make the array mutable initially) | |
| - Initialized a carry 1 | |
| - Iterated from the least significant digit, now at index 0 | |
| - I kept moving from left to right, adding 1 if > 9 else add 1 to the first digit | |
| - Reversed the array back. | |
| Pretty easy | |
| https://leetcode.com/problems/plus-one/submissions/1870882523 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * @param {number[]} height | |
| * @return {number} | |
| */ | |
| var maxArea = function(height) { | |
| let left = 0 | |
| let right = height.length - 1 | |
| let answer = 0 | |
| while(left < right) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * @param {number[]} nums | |
| * @return {number[][]} | |
| */ | |
| var subsets = function(nums) { | |
| if(nums.length < 2) return nums | |
| let result = [] | |
| function recurse(i, temp) { |