Skip to content
the poor coder

Home / Topics / #array

#array

35 posts · page 2 of 2
2021

Leetcode - Sort Array By Parity Solution

Given an array A of non-negative integers, return an array consisting of all the even elements of A, followed by all the odd elements of A. You may return any answer array that satisfies this condition. Example 1: Note…

leetcodearray1 min read
2021

Leetcode - Flipping an Image Solution

Given an n x n binary matrix image, flip the image horizontally, then invert it, and return the resulting image. To flip an image horizontally means that each row of the image is reversed. For example, flipping [1,1,0]…

leetcodearray2 min read
2021

Leetcode - Triangle Solution

Given a triangle array, return the minimum path sum from top to bottom. For each step, you may move to an adjacent number of the row below. More formally, if you are on index i on the current row, you may move to either…

2021

Leetcode - Pascal's Triangle II Solution

Given an integer rowIndex, return the rowIndexth (0-indexed) row of the Pascal's triangle. In Pascal's triangle, each number is the sum of the two numbers directly above it as shown: Example 1: Example 2: Example 3…

leetcodearray1 min read
2021

Leetcode - Pascal's Triangle Solution

Given an integer numRows, return the first numRows of Pascal's triangle. In Pascal's triangle, each number is the sum of the two numbers directly above it as shown: Example 1: Example 2: Constraints: 1 <= numRows <= 30…

leetcodearray1 min read
2021

Leetcode - Word Search Solution

Given an m x n grid of characters board and a string word, return true if word exists in the grid. The word can be constructed from letters of sequentially adjacent cells, where adjacent cells are horizontally or…

2021

Leetcode - Subsets Solution

Given an integer array nums of unique elements, return all possible subsets (the power set). The solution set must not contain duplicate subsets. Return the solution in any order. Example 1: Example 2: Constraints: 1 <=…

2021

Leetcode - Sort Colors Solution

Given an array nums with n objects colored red, white, or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order red, white, and blue. We will use the integers 0, 1, and 2…

2021

Leetcode - Plus One Solution

Given a non-empty array of decimal digits representing a non-negative integer, increment one to the integer. The digits are stored such that the most significant digit is at the head of the list, and each element in the…

leetcodearray1 min read
2021

Leetcode - Remove Element Solution

Given an array nums and a value val, remove all instances of that value in-place and return the new length. Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1)…

ESC