Leetcode Solutions [Solved] Given an integer array nums and an integer k, return true if there are two distinct indices i and j in the array such that nums[i] == nums[j] and abs(i – j) <= k. [Solved] Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct. [Solved] Given an integer array nums and an integer k, return the kth largest element in the array. Note that it is the kth largest element in the sorted order, not the kth distinct element. [Solved] Given the head of a singly linked list, reverse the list, and return the reversed list. [Solved] Given an integer n, return the number of prime numbers that are strictly less than n. [Solved] Write an algorithm to determine if a number n is happy. A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits. [Solved] Write an SQL query to delete all the duplicate emails, keeping only one unique email with the smallest id. Note that you are supposed to write a DELETE statement and not a SELECT one. [Solved] Write a function that takes an unsigned integer and returns the number of ‘1’ bits it has (also known as the Hamming weight). [Solved] Given an array, rotate the array to the right by k steps, where k is non-negative. [Solved] Write an SQL query to report all the duplicate emails. Return the result table in any order. [Solved] Given a string columnTitle that represents the column title as appears in an Excel sheet, return its corresponding column number. [Solved] Given an integer n, return the number of trailing zeroes in n!. Note that n! = n * (n – 1) * (n – 2) * … * 3 * 2 * 1. [Solved] 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. Let these two numbers be numbers[index1] and numbers[index2] where 1 <= index1 < index2 <= numbers.length. [Solved] Given an array nums of size n, return the majority element. The majority element is the element that appears more than ⌊n / 2⌋ times. You may assume that the majority element always exists in the array. [Solved] Given two version numbers, version1 and version2, compare them. Version numbers consist of one or more revisions joined by a dot ‘.’. Each revision consists of digits and may contain leading zeros. Every revision contains at least one character. [Solved] Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. [Solved] You are given the head of a singly linked-list. The list can be represented as: L0 → L1 → … → Ln – 1 → Ln Reorder the list to be on the following form: L0 → Ln → L1 → Ln – 1 → L2 → Ln – 2 → … [Solved] Given the head of a linked list, return the node where the cycle begins. If there is no cycle, return null. [Solved] Given head, the head of a linked list, determine if the linked list has a cycle in it. [Solved] Given an integer array nums where every element appears three times except for one, which appears exactly once. Find the single element and return it. You must implement a solution with a linear runtime complexity and use only constant extra space. «Previous Page 1 … 7 8 9 10 11 … 14 Next Page»