Skip to content

Instantly share code, notes, and snippets.

View D-Lite's full-sized avatar
💭
Software Engineer

Daniel Olabemiwo D-Lite

💭
Software Engineer
View GitHub Profile
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
/**
* @param {number[]} height
* @return {number}
*/
var maxArea = function(height) {
let left = 0
let right = height.length - 1
let answer = 0
while(left < right) {
/**
* @param {number[]} nums
* @return {number[][]}
*/
var subsets = function(nums) {
if(nums.length < 2) return nums
let result = []
function recurse(i, temp) {