10 2019 档案
摘要:Given an array of meeting time intervals where intervals[i] = [start, end], determine if a person could attend all meetings. Example 1: Input: interva
阅读全文
摘要: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 wron
阅读全文
摘要:Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if i
阅读全文
摘要:Given two strings s and t, determine if they are isomorphic. Two strings s and t are isomorphic if the characters in s can be replaced to get t. All o
阅读全文
摘要:Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively. Below is one possible representati
阅读全文
摘要:Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index. According
阅读全文
摘要:We define the Perfect Number is a positive integer that is equal to the sum of all its positive divisors except itself. Now, given an integer n, write
阅读全文
摘要:You are given two integer arrays nums1 and nums2, sorted in non-decreasing order, and two integers m and n, representing the number of elements in num
阅读全文
摘要:Given an integer array nums, move all 0's to the end of it while maintaining the relative order of the non-zero elements. Note that you must do this i
阅读全文
摘要:Given an array of integers nums containing n + 1 integers where each integer is in the range [1, n] inclusive. There is only one repeated number in nu
阅读全文
摘要:Count the number of prime numbers less than a non-negative number, n. Example 1: Input: n = 10 Output: 4 Explanation: There are 4 prime numbers less t
阅读全文
摘要:Write a program to find the n-th ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. Example: Input: n = 10 Outpu
阅读全文
摘要:Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. Example
阅读全文
摘要:Given a positive integer n and you can do operations as follow: If n is even, replace n with n/2. If n is odd, you can replace n with either n + 1 or
阅读全文
摘要:Implement pow(x, n), which calculates x raised to the power n (x^n). Example 1: Input: 2.00000, 10 Output: 1024.00000 Example 2: Input: 2.10000, 3 Out
阅读全文
摘要:Given a positive integer num, write a function which returns True if num is a perfect square else False. Follow up: Do not use any built-in library fu
阅读全文
摘要:Given a non-negative integer x, return the square root of x rounded down to the nearest integer. The returned integer should be non-negative as well.
阅读全文
摘要:Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. Example: Input: 38 Output: 2 Explanation: The pro
阅读全文
摘要:The DNA sequence is composed of a series of nucleotides abbreviated as 'A', 'C', 'G', and 'T'. For example, "ACGAATTCCG" is a DNA sequence. When study
阅读全文
摘要:Given an array nums with n objects colored red, white, or blue, sort them in-place so that objects of the same color are adjacent, with the colors in
阅读全文
摘要:Given a string array words, return the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. If no such
阅读全文
摘要:Write a function that takes an unsigned integer and returns the number of '1' bits it has (also known as the Hamming weight). Note: Note that in some
阅读全文
摘要: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. Example 1:
阅读全文
摘要:Given the head of a singly linked list, reverse the list, and return the reversed list. Example 1: Input: head = [1,2,3,4,5] Output: [5,4,3,2,1] Examp
阅读全文
摘要: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 intege
阅读全文
摘要:You are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contai
阅读全文
摘要:You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes conta
阅读全文
摘要:Implement the myAtoi(string s) function, which converts a string to a 32-bit signed integer. The algorithm for myAtoi(string s) is as follows: Whitesp
阅读全文
摘要:Write a function that reverses a string. The input string is given as an array of characters s. You must do this by modifying the input array in-place
阅读全文
摘要:The array-form of an integer num is an array representing its digits in left to right order. For example, for num = 1321, the array form is [1,3,2,1].
阅读全文
摘要:Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if:
阅读全文
摘要:Given a string s, find the first non-repeating character in it and return its index. If it does not exist, return -1. Example 1: Input: s = "leetcode"
阅读全文
摘要:Given two stings ransomNote and magazine, return true if ransomNote can be constructed from magazine and false otherwise. Each letter in magazine can
阅读全文
摘要:Given two strings s and t, return true if t is an anagram of s, and false otherwise. An Anagram is a word or phrase formed by rearranging the letters
阅读全文
摘要:You are given a large integer represented as an integer array digits, where each digits[i] is the ith digit of the integer. The digits are ordered fro
阅读全文
摘要:Given an unsorted array of integers nums, return the length of the longest consecutive elements sequence. You must write an algorithm that runs in O(n
阅读全文
摘要:Given the head of a linked list and an integer val, remove all the nodes of the linked list that has Node.val == val, and return the new head. Example
阅读全文
摘要:Given an integer array nums, return true if there exists a triple of indices (i, j, k) such that i < j < k and nums[i] < nums[j] < nums[k]. If no such
阅读全文
摘要:Given an integer array nums and an integer val, remove all occurrences of val in nums in-place. The relative order of the elements may be changed. Sin
阅读全文
摘要:Given a signed 32-bit integer x, return x with its digits reversed. If reversing x causes the value to go outside the signed 32-bit integer range [-23
阅读全文
摘要:Design a data structure that accepts a stream of integers and checks if it has a pair of integers that sum up to a particular value. Implement the Two
阅读全文
摘要: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 targe
阅读全文
摘要:Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each inp
阅读全文

浙公网安备 33010602011771号