Leetcode Solutions [Solved] Given a m x n matrix grid which is sorted in non-increasing order both row-wise and column-wise, return the number of negative numbers in grid. [Solved] Given an integer num, return the number of steps to reduce it to zero. [Solved] You are given an m x n binary matrix mat of 1’s (representing soldiers) and 0’s (representing civilians). The soldiers are positioned in front of the civilians. That is, all the 1’s will appear to the left of all the 0’s in each row. [Solved] You are given a string s consisting only of letters ‘a’ and ‘b’. In a single step you can remove one palindromic subsequence from s. Return the minimum number of steps to make the given string empty. [Solved] Given a binary tree root and an integer target, delete all the leaf nodes with value target. [Solved] You are given a positive integer num consisting only of digits 6 and 9. Return the maximum number you can get by changing at most one digit (6 becomes 9, and 9 becomes 6). [Solved] No-Zero integer is a positive integer that does not contain any 0 in its decimal representation. Given an integer n, return a list of two integers [A, B] where: [Solved] Given the root of a binary tree, return the sum of values of nodes with an even-valued grandparent. If there are no nodes with an even-valued grandparent, return 0. A grandparent of a node is the parent of its parent if it exists. [Solved] We are given a list nums of integers representing a list compressed with run-length encoding. Consider each adjacent pair of elements [freq, val] = [nums[2*i], nums[2*i+1]] (with i >= 0). For each such pair, there are freq elements with value val concatenated in a sublist. Concatenate all the sublists from left to right to generate the decompressed list. Return the decompressed list. [Solved] You are given a string s formed by digits and ‘#’. We want to map s to English lowercase characters as follows: Characters (‘a’ to ‘i’) are represented by (‘1’ to ‘9’) respectively. Characters (‘j’ to ‘z’) are represented by (’10#’ to ’26#’) respectively. [Solved] Given two binary search trees root1 and root2, return a list containing all the integers from both trees sorted in ascending order. [Solved] Given an integer n, return any array containing n unique integers such that they add up to 0. [Solved] Given the root of a binary tree, return the sum of values of its deepest leaves. [Solved] Given an array arr, replace every element in that array with the greatest element among the elements to its right, and replace the last element with -1. After doing so, return the array. [Solved] Given an array nums of integers, return how many of them contain an even number of digits. [Solved] Given head which is a reference node to a singly-linked list. The value of each node in the linked list is either 0 or 1. The linked list holds the binary representation of a number. Return the decimal value of the number in the linked list. [Solved] Given an integer array sorted in non-decreasing order, there is exactly one integer in the array that occurs more than 25% of the time, return that integer. [Solved] Given an integer number n, return the difference between the product of its digits and the sum of its digits. [Solved] On a 2D plane, there are n points with integer coordinates points[i] = [xi, yi]. Return the minimum time in seconds to visit all the points in the order given by points. [Solved] Given a 2D grid of size m x n and an integer k. You need to shift the grid k times. «Previous Page 1 2 3 4 … 14 Next Page»