随笔分类 - leetcode
摘要:#题目简述:Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: ...
阅读全文
摘要:#题目描述:Compare two version numbers version1 and version2.If version1 > version2 return 1, if version1 int(v2[i]): return 1 ...
阅读全文
摘要:#题目简述:Given numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], ...
阅读全文
摘要:#题目描述: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...
阅读全文
摘要:#题目简述:Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set.get(key) - Ge...
阅读全文
摘要:#题目描述:Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two...
阅读全文
摘要:#题目描述:Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.#解题思路:首先我们要了解罗马数字怎么写的个位数举例I, 1 】II, 2】...
阅读全文
摘要:#题目简述:Given a list of non negative integers, arrange them such that they form the largest number.For example, given [3, 30, 34, 5, 9], the largest for...
阅读全文
摘要:#题目描述:Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating lett...
阅读全文
摘要:#题目简述:Determine whether an integer is a palindrome. Do this without extra space.Some hints:Could negative integers be palindromes? (ie, -1)If you are ...
阅读全文
摘要:#题目简述:Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set ...
阅读全文
摘要:#题目描述:You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a s...
阅读全文
摘要:#题目简述:There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity shou...
阅读全文
摘要:#题目简述:Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in...
阅读全文
摘要:#题目描述:Given an integer n, return the number of trailing zeroes in n!.**Note**: Your solution should be in logarithmic time complexity.#解题思路:这个题目给的评级是e...
阅读全文
摘要:#题目概述:Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn...
阅读全文
摘要:#题目概述: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 tha...
阅读全文
摘要:#题目简述:You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can y...
阅读全文
摘要:#题目简述:Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the ...
阅读全文
摘要:#题目简述:Given an absolute path for a file (Unix-style), simplify it.For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c"click to sho...
阅读全文

浙公网安备 33010602011771号