1 |
Two Sum |
Given an array of integers, return indices of the two numbers such that they add up to a specific target. |
Solution |
7 |
Reverse Integer |
Given a 32-bit signed integer, reverse digits of an integer. |
Solution |
8 |
String to Integer (atoi) |
Implement atoi which converts a string to an integer. |
Solution |
9 |
Palindrome Number |
Given an integer, return true if it is a palindrome, and false otherwise. |
Solution |
12 |
Integer to Roman |
Given an integer, convert it to a roman numeral. |
Solution |
13 |
Roman to Integer |
Given a roman numeral, convert it to an integer. |
Solution |
14 |
Longest Common Prefix |
Find the longest common prefix string amongst an array of strings. |
Solution |
20 |
Valid Parentheses |
Given a string, determine if the input string is valid. |
Solution |
65 |
Valid Number |
Validate if a given string can be interpreted as a decimal number. |
Solution |
66 |
Plus One |
Increment the large integer by one and return the resulting array of digits. |
Solution |
94 |
Binary Tree Inorder Traversal |
Given the root of a binary tree, return the inorder traversal of its nodes’ values. |
Solution |
100 |
Same Tree |
Given the roots of two binary trees p and q, write a function to check if they are the same or not. |
Solution |
104 |
Maximum Depth of Binary Tree |
Given the root of a binary tree, return its maximum depth. |
Solution |
125 |
Valid Palindrome |
Given a string s, return true if it is a palindrome, or false otherwise. |
Solution |
136 |
Single Number |
Given a non-empty array of integers nums, every element appears twice except for one. Find that single one. |
Solution |
141 |
Linked List Cycle |
Return true if there is a cycle in the linked list. Otherwise, return false. |
Solution |
167 |
Two Sum II |
Given a 1-indexed array of integers numbers that is already sorted in non-decreasing order, find two numbers such that they add up to a specific target number. Return the indices of the two numbers, added by one as an integer array of length 2. |
Solution |
169 |
Majority Element |
Given an array nums of size n, return the majority element. |
Solution |
175 |
Combine Two Tables |
Report the first name, last name, city, and state of each person in the table. |
Solution |
204 |
Count Primes |
Count the number of prime numbers less than a non-negative number, n. |
Solution |
242 |
Valid Anagram |
Given two strings s and t, return true if t is an anagram of s, and false otherwise. |
Solution |
258 |
Add Digits |
Given an integer, repeatedly add all its digits until the result has only one digit. |
Solution |
283 |
Move Zeroes |
Given an integer array, move all 0’s to the end of it while maintaining the relative order of the non-zero elements. |
Solution |
344 |
Reverse String |
Write a function that reverses a string. The input string is given as an array of characters s. |
Solution |
349 |
Intersection of Two Arrays |
Given two integer arrays, return an array of their intersection. |
Solution |
389 |
Find the Difference |
You are given two strings s and t. String t is generated by random shuffling string s and then add one more letter at a random position. Return the letter that was added to t. |
Solution |
448 |
Find All Numbers Disappeared in an Array |
Given an array of integers, return an array of all the integers that do not appear in nums. |
Solution |
584 |
Find Customer Referee |
Find the names of the customer that are not referred by the customer with id = 2. |
Solution |
595 |
Big Countries |
A country is big if it has an area of bigger than 3 million square km or a population of more than 25 million. Write a SQL solution to output big countries’ name, population and area. |
Solution |
620 |
Not Boring Movies |
Write a SQL query to output movies with an odd numbered ID and a description that is not ‘boring’. |
Solution |
665 |
Non-decreasing Array |
Given an array, check if it could become non-decreasing by modifying at most 1 element. |
Solution |
704 |
Binary Search |
Given an array of integers, write a function to search target in nums. |
Solution |
709 |
To Lower Case |
Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase. |
Solution |
771 |
Jewels and Stones |
You’re given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in S is a type of stone you have. You want to know how many of the stones you have are also jewels. |
Solution |
922 |
Sort Array By Parity II |
Given an array of integers nums, half of the integers in nums are odd, and the other half are even. Sort the array so that whenever nums[i] is odd, i is odd, and whenever nums[i] is even, i is even. Return any answer array that satisfies this condition. |
Solution |
933 |
Number of Recent Calls |
Return the number of requests that have happened in the inclusive range |
Solution |
1108 |
Defanging an IP Address |
Given a valid IP address, return a defanged version of that IP address. |
Solution |
1148 |
Article Views I |
Write a solution to find all the authors that viewed at least one of their own articles. Return the result table sorted by id in ascending order. |
Solution |
1207 |
Unique Number of Occurrences |
Given an array of integers, write a function that returns true if and only if the number of occurrences of each value in the array is unique. |
Solution |
1281 |
Subtract the Product and Sum of Digits of an Integer |
Given an integer, return the difference between the product of its digits and the sum of its digits. |
Solution |
1295 |
Numbers with Even Number of Digits |
Given an array nums of integers, return how many of them contain an even number of digits. |
Solution |
1313 |
Decompress Run-Length Encoded List |
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[2i], nums[2i+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. |
Solution |
1342 |
Number of Steps to Reduce a Number to Zero |
Given a non-negative integer num, return the number of steps to reduce it to zero. If the current number is even, you have to divide it by 2, otherwise, you have to subtract 1 from it. |
Solution |
1365 |
How Many Numbers Are Smaller Than the Current Number |
Given the array nums, for each nums[i] find out how many numbers in the array are smaller than it. That is, for each nums[i] you have to count the number of valid j’s such that j != i and nums[j] < nums[i]. |
Solution |
1046 |
Last Stone Weight |
Return the weight of the last remaining stone. If there are no stones left, return 0. |
Solution |
1431 |
Kids With the Greatest Number of Candies |
For each kid check if there is a way to distribute extraCandies among the kids such that he or she can have the greatest number of candies among them. Notice that multiple kids can have the greatest number of candies. |
Solution |
1470 |
Shuffle the Array |
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]. |
Solution |
1476 |
Subrectangle Queries |
Implement the class SubrectangleQueries which receives a rows x cols rectangle as a matrix of integers in the constructor and supports two methods. |
Solution |
1480 |
Running Sum of 1d Array |
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. |
Solution |
1486 |
XOR Operation in an Array |
Given an integer n and an integer start. Define an array nums where nums[i] = start + 2*i (0-indexed) and n == nums.length. Return the bitwise XOR of all elements of nums. |
Solution |
1512 |
Number of Good Pairs |
Given an array of integers nums. A pair (i,j) is called good if nums[i] == nums[j] and i < j. Return the number of good pairs. |
Solution |
1528 |
Shuffle String |
Given a string s and an integer array indices of the same length. The string s will be shuffled such that the character at the ith position moves to indices[i] in the shuffled string. Return the shuffled string. |
Solution |
1603 |
Design Parking System |
Design a parking system for a parking lot. The parking lot has three kinds of parking spaces: big, medium, and small, with a fixed number of slots for each size. |
Solution |
1672 |
Richest Customer Wealth |
You are given an m x n integer grid accounts where accounts[i][j] is the amount of money the ith customer has in the jth bank. Return the wealth that the richest customer has. A customer’s wealth is the amount of money they have in all their bank accounts. The richest customer is the customer that has the maximum wealth. |
Solution |
1683 |
Invalid Tweets |
Write a solution to find the IDs of the invalid tweets. The tweet is invalid if the number of characters used in the content of the tweet is strictly greater than 15. |
Solution |
1757 |
Recyclable and Low Fat Products |
Write a solution to find the ids of products that are both low fat and recyclable. |
Solution |
1920 |
Build Array from Permutation |
Given a zero-based permutation nums (0-indexed), build an array ans of the same length where ans[i] = nums[nums[i]] for each 0 <= i < nums.length and return it. |
Solution |
1929 |
Concatenation of Array |
Given an integer array nums of length n, you want to create an array ans of length 2n where ans[i] == nums[i] and ans[i + n] == nums[i] for 0 <= i < n (0-indexed). Specifically, ans is the concatenation of two nums arrays. Return the array ans. |
Solution |
2011 |
Final Value of Variable After Performing Operations |
Given an array of strings operations containing a list of operations, return the final value of X after performing all the operations. |
Solution |
2114 |
Maximum Number of Words Found in Sentences |
Return the maximum number of words that appear in a single sentence. |
Solution |
2235 |
Add Two Integers |
Given two integers num1 and num2, return the sum of the two integers. |
Solution |
2413 |
Smallest Even Multiple |
Given a positive integer n, return the smallest positive integer that is a multiple of both 2 and n. |
Solution |
2469 |
Convert the Temperature |
You should convert Celsius into Kelvin and Fahrenheit and return it as an array ans = [kelvin, fahrenheit]. |
Solution |
2703 |
Return Length of Arguments Passed |
Write a function argumentsLength that returns the count of arguments passed to it. |
Solution |
2723 |
Add Two Promises |
Given two promises, return a new promise. The returned promise should resolve with the sum of the two numbers. |
Solution |
2769 |
Find the Maximum Achievable Number |
Return the maximum possible achievable number. |
Solution |
2942 |
Find Words Containing Character |
You are given an array of strings words and a character. Return an array of indices representing the words that contain the character. |
Solution |
2951 |
Find the Peaks |
Return an array that consists of indices of peaks in the given array in any order. |
Solution |