Skip to content
the poor coder

Home / Topics / #array

#array

35 posts
2021

Leetcode - Find the Highest Altitude Solution

There is a biker going on a road trip. The road trip consists of n + 1 points at different altitudes. The biker starts his trip on point 0 with altitude equal 0. You are given an integer array gain of length n where…

leetcodearray1 min read
2021

Leetcode - Average Waiting Time Solution

There is a restaurant with a single chef. You are given an array customers, where customers[i] = [arrivali, timei]: arrivali is the arrival time of the ith customer. The arrival times are sorted in non-decreasing order…

leetcodearray4 min read
2021

Leetcode - Richest Customer Wealth Solution

You are given an m x n integer grid accounts where accounts[i][j] is the amount of money the i​​​​​​​​​​​th​​​​ customer has in the j​​​​​​​​​​​th​​​​ bank. Return the wealth that the richest customer has. A customer's…

leetcodearray1 min read
2021

Leetcode - Running Sum of 1d Array Solution

Given an array nums. We define a running sum of an array as runningSum[i] = sum(nums[0]…nums[i]). Return the running sum of nums. Example 1: Example 2: Example 3: Constraints: 1 <= nums.length <= 1000 -10^6 <= nums[i]…

leetcodearray1 min read
2021

Leetcode - Shuffle the Array Solution

Given the array nums consisting of 2n elements in the form [x1,x2,...,xn,y1,y2,...,yn]. Return the array in the form [x1,y1,x2,y2,...,xn,yn]. Example 1: Example 2: Example 3: Constraints: 1 <= n <= 500 nums.length == 2n…

leetcodearray1 min read
2021

Leetcode - Height Checker Solution

A school is trying to take an annual photo of all the students. The students are asked to stand in a single file line in non-decreasing order by height. Let this ordering be represented by the integer array expected…

leetcodearray1 min read
ESC