02 2017 档案
摘要:题目: Implement the following operations of a stack using queues. push(x) -- Push element x onto stack. pop() -- Removes the element on top of the stack
阅读全文
摘要:题目: 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 nums[i] = nums[j] and
阅读全文
摘要:题目: Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the
阅读全文
摘要:题目: Reverse a singly linked list. 链接: http://leetcode.com/problems/reverse-linked-list/ 2/25/2017, Java 之前的错误:看起来第一遍没有任何问题,但是1->2居然是time limit exceede
阅读全文
摘要:题目: Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t. All occur
阅读全文
摘要:题目: Description: Count the number of prime numbers less than a non-negative number, n. Credits:Special thanks to @mithmatt for adding this problem and
阅读全文
摘要:题目: Remove all elements from a linked list of integers that have value val. ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 -->
阅读全文
摘要:题目: Write an algorithm to determine if a number is "happy". A happy number is a number defined by the following process: Starting with any positive in
阅读全文
摘要:题目: You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stoppin
阅读全文
摘要:题目: Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight). For example, the 32-
阅读全文
摘要:题目: Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), r
阅读全文
摘要:题目: 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,6,7,1,2,3,4].
阅读全文
摘要:题目: Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in logarithmic time complexity. 链接: http://leetcode.
阅读全文
摘要:题目: Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, return its corresponding column number. For example
阅读全文
摘要:题目: Design and implement a TwoSum class. It should support the following operations: add and find. add - Add the number to an internal data structure.
阅读全文
摘要:题目: Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that
阅读全文
摘要:题目: Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example: 链接: http://leetcode.com/problems/excel-s
阅读全文
摘要:题目: Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The func
阅读全文
摘要:题目: 链接: http://leetcode.com/problems/intersection-of-two-linked-lists/ 2/19/2017, Java 一开始的思路是,借用判断cycled linked list来。先从nodeA出发遍历,把最后一个node的next设为nod
阅读全文
摘要:题目: The API: int read4(char *buf) reads 4 characters at a time from a file. The return value is the actual number of characters read. For example, it
阅读全文
摘要:题目: Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) -- Push element x onto stack. pop() -- R
阅读全文
摘要:题目: Given a linked list, determine if it has a cycle in it. Follow up:Can you solve it without using extra space? 链接: http://leetcode.com/problems/lin
阅读全文
摘要:题目: Given an array of integers, every element appears twice except for one. Find that single one. Note:Your algorithm should have a linear runtime com
阅读全文
摘要:题目: Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may co
阅读全文
摘要:Given an array where elements are sorted in ascending order, convert it to a height balanced BST. https://leetcode.com/problems/convert-sorted-array-t
阅读全文
摘要:题目: Implement int sqrt(int x). Compute and return the square root of x. 链接: http://leetcode.com/problems/sqrtx/ 2/14/2017, Java,不是自己想的。。。 二分法,需要进行第3行的
阅读全文
摘要:题目: Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [-2,1,-3,4,-
阅读全文
摘要:题目: Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted i
阅读全文
摘要:题目: Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. 链接:https://leetcode.com/problems/roman
阅读全文
浙公网安备 33010602011771号