Leetcode Solutions [Solved] Given an array of strings words, return the words that can be typed using letters of the alphabet on only one row of American keyboard like the image below. [Solved] Given a binary array nums, return the maximum number of consecutive 1’s in the array. [Solved] Given a string queryIP, return “IPv4” if IP is a valid IPv4 address, “IPv6” if IP is a valid IPv6 address or “Neither” if IP is not a correct IP of any type. [Solved] You are given row x col grid representing a map where grid[i][j] = 1 represents land and grid[i][j] = 0 represents water. Grid cells are connected horizontally/vertically (not diagonally). The grid is completely surrounded by water, and there is exactly one island (i.e., one or more connected land cells). [Solved] The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integers x and y, return the Hamming distance between them. [Solved] Given an array nums of n integers where nums[i] is in the range [1, n], return an array of all the integers in the range [1, n] that do not appear in nums. [Solved] You have n coins and you want to build a staircase with these coins. The staircase consists of k rows where the ith row has exactly i coins. The last row of the staircase may be incomplete. Given the integer n, return the number of complete rows of the staircase you will build. [Solved] Given an integer n, return a string array answer (1-indexed) where: answer[i] == “FizzBuzz” if i is divisible by 3 and 5. answer[i] == “Fizz” if i is divisible by 3. answer[i] == “Buzz” if i is divisible by 5. answer[i] == i (as a string) if none of the above conditions are true. [Solved] Given the root of a binary tree, return the sum of all left leaves. A leaf is a node with no children. A left leaf is a leaf that is the left child of another node. [Solved] Given a string s, find the first non-repeating character in it and return its index. If it does not exist, return -1. [Solved] Given two strings s and t, return true if s is a subsequence of t, or false otherwise. A subsequence of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i.e., “ace” is a subsequence of “abcde” while “aec” is not). [Solved] 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. [Solved] Given two strings ransomNote and magazine, return true if ransomNote can be constructed by using the letters from magazine and false otherwise. [Solved] We are playing the Guess Game. The game is as follows: I pick a number from 1 to n. You have to guess which number I picked. Every time you guess wrong, I will tell you whether the number I picked is higher or lower than your guess. You call a pre-defined API int guess(int num), which returns three possible results: [Solved] Given a positive integer num, write a function which returns True if num is a perfect square else False. [Solved] Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must appear as many times as it shows in both arrays and you may return the result in any order. [Solved] Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must be unique and you may return the result in any order. [Solved] Given a string s, reverse only all the vowels in the string and return it. [Solved] Write a function that reverses a string. The input string is given as an array of characters s. [Solved] Given an integer n, return true if it is a power of four. Otherwise, return false. «Previous Page 1 … 5 6 7 8 9 … 14 Next Page»