Leetcode Solutions [Solved] Given an integer n, return an array ans of length n + 1 such that for each i (0 <= i <= n), ans[i] is the number of 1's in the binary representation of i. [Solved] Given the head of a singly linked list, group all the nodes with odd indices together followed by the nodes with even indices, and return the reordered list. The first node is considered odd, and the second node is even, and so on. [Solved] Given an integer n, return true if it is a power of three. Otherwise, return false. [Solved] Given an integer array nums, return the length of the longest strictly increasing subsequence. A subsequence is a sequence that can be derived from an array by deleting some or no elements without changing the order of the remaining elements. For example, [3,6,2,7] is a subsequence of the array [0,3,1,6,2,2,7]. [Solved] Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted across a network connection link to be reconstructed later in the same or another computer environment. [Solved] The median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value and the median is the mean of the two middle values. [Solved] You are playing the following Nim Game with your friend: Initially, there is a heap of stones on the table. You and your friend will alternate taking turns, and you go first. On each turn, the person whose turn it is will remove 1 to 3 stones from the heap. The one who removes the last stone is the winner. [Solved] Given a pattern and a string s, find if s follows the same pattern. Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in s. [Solved] Given an integer array nums, move all 0’s to the end of it while maintaining the relative order of the non-zero elements. [Solved] You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on the previous version, all the versions after a bad version are also bad. [Solved] Given an array nums containing n distinct numbers in the range [0, n], return the only number in the range that is missing from the array. [Solved] Given an integer num, repeatedly add all its digits until the result has only one digit, and return it. [Solved] Given the root of a binary tree, return all root-to-leaf paths in any order. [Solved] Given two strings s and t, return true if t is an anagram of s, and false otherwise. [Solved] You are given an array of integers nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window moves right by one position. [Solved] Given an integer array nums, return an array answer such that answer[i] is equal to the product of all the elements of nums except nums[i]. [Solved] There is a singly-linked list head and we want to delete a node node in it. You are given the node to be deleted node. You will not be given access to the first node of head. [Solved] Given the head of a singly linked list, return true if it is a palindrome or false otherwise. [Solved] Given an integer n, return true if it is a power of two. Otherwise, return false. An integer n is a power of two, if there exists an integer x such that n == 2x. [Solved] Given the root of a binary search tree, and an integer k, return the kth smallest value (1-indexed) of all the values of the nodes in the tree. «Previous Page 1 … 6 7 8 9 10 … 14 Next Page»