Leetcode 0283. Move Zeroes
Given an integer array `nums`, move all `0`'s to the end of it while maintaining the relative order of the non-zero elements. Note that you must do this in-place without making a copy of ...
Given an integer array `nums`, move all `0`'s to the end of it while maintaining the relative order of the non-zero elements. Note that you must do this in-place without making a copy of ...
The next greater element of some element `x` in an array is the first greater element that is to the right of x in the same array. You are given two distinct 0-indexed integer arrays `num...
Given the `root` of an n-ary tree, return the preorder traversal of its nodes' values. Nary-Tree input serialization is represented in their level order traversal. Each group of children ...
You are given two strings `s1` and `s2` of equal length. A string swap is an operation where you choose two indices in a string (not necessarily different) and swap the characters at these ind...
A sequence of numbers is called an arithmetic progression if the difference between any two consecutive elements is the same. Given an array of numbers `arr`, return `true` if the array c...
There is a function `signFunc(x)` that returns: • `1` if `x` is positive. • `-1` if `x` is negative. • `0` if `x` is equal to `0`. You are given an integer array `nums`. Let ...
You are given two integers, `x` and `y`, which represent your current location on a Cartesian grid: `(x, y)`. You are also given an array `points` where each `points[i] = [ai, bi]` represents ...
Given an integer array `nums`, return _the largest perimeter of a triangle with a non-zero area, formed from three of these lengths_. If it is impossible to form any triangle of a non-zero are...
Given an integer number `n`, return the difference between the product of its digits and the sum of its digits. Example 1: Input: n = 234, Output: 15 Product of digits = 2 ...
Write a function that takes an unsigned integer and returns the number of '1' bits it has (also known as the Hamming weight). Note: - Note that in some languages, such as Java, there...