随笔分类 - leetcode
摘要:219. Contains Duplicate II Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that
阅读全文
摘要:217. Contains Duplicate Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears a
阅读全文
摘要:206. Reverse Linked List Reverse a singly linked list. 翻转一个单链表。 代码如下:
阅读全文
摘要:205. Isomorphic Strings Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced
阅读全文
摘要:202. Happy Number Write an algorithm to determine if a number is "happy". A happy number is a number defined by the following process: Starting with a
阅读全文
摘要:198. House Robber You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only cons
阅读全文
摘要:191. Number of 1 Bits Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight). Fo
阅读全文
摘要:190. Reverse Bits Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 0000001010010100000111
阅读全文
摘要:189. Rotate Array Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5
阅读全文
摘要:172. Factorial Trailing Zeroes Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in logarithmic time compl
阅读全文
摘要:171. Excel Sheet Column Number Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, return its corresponding
阅读全文
摘要:169. Majority Element Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. Y
阅读全文
摘要:168. Excel Sheet Column Title Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example:
阅读全文
摘要:165. Compare Version Numbers Compare two version numbers version1 and version2.If version1 > version2 return 1, if version1 < version2 return -1, othe
阅读全文
摘要:160. Intersection of Two Linked Lists Write a program to find the node at which the intersection of two singly linked lists begins. For example, the f
阅读全文
摘要:155. Min Stack Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) -- Push element x onto stack.
阅读全文
摘要:141. Linked List Cycle Given a linked list, determine if it has a cycle in it. Follow up:Can you solve it without using extra space? 判断一个单链表中是否存在环。不利用
阅读全文
摘要:137. Single Number II Given an array of integers, every element appears three times except for one. Find that single one. Note:Your algorithm should h
阅读全文
摘要:136. Single Number Given an array of integers, every element appears twice except for one. Find that single one. Note:Your algorithm should have a lin
阅读全文
摘要:125. Valid Palindrome Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example,"A man
阅读全文

浙公网安备 33010602011771号