随笔分类 - leetcode
摘要:#题目描述:##Excel Sheet Column TitleGiven a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A ...
阅读全文
摘要:#题目概要:Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.For example,Given the following matrix: ...
阅读全文
摘要:题目描述: Given a collection of numbers, return all possible permutations. For example, have the following permutations: , and . 解题思路: 这道题目由于是求所有的全排列,比较直观
阅读全文
摘要:#题目描述: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...
阅读全文
摘要:#题目描述:Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in t...
阅读全文
摘要:Max Points on a Line题目描述:Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.解题思路:1.首先由这么一个O(n^3)的方法,也就...
阅读全文
摘要:Evaluate Reverse Polish Notation题目描述:Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -,, /. Each oper...
阅读全文
摘要:题目概述:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Find the minimum eleme...
阅读全文
摘要:题目描述:Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Re...
阅读全文
摘要:题目描述: Implement int sqrt(int x). Compute and return the square root of x. 实现开根号,并且返回整数值(这个很重要,不是整数的话就有一种方法用不了了) 方法一:二分法,另外由于我们知道开根号的结果肯定小于等于这个数的二分之一,所
阅读全文
摘要:问题描述:Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit ...
阅读全文
摘要:题目描述:Single NumberGiven an array of integers, every element appears twice except for one. Find that single one.Note: Your algorithm should have a line...
阅读全文
摘要:题目描述:Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.这道题的意思是将数字换算成罗马数字的表示形式,当然首先我们要理解罗马数字的编码...
阅读全文
摘要:题目描述:There areNchildren standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following ...
阅读全文
摘要:题目描述:Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321很简单的题目其实用个数组就能解决了,不过用了一下queue,注意负数的情况。 1 class Solution { ...
阅读全文
摘要:题目描述:Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra space ...
阅读全文
摘要:今天第一次在leetcode上提交了一个题目,据说这个网站基本上都是名企面试笔试题,今天无意一进去就看到第一题居然就是昨天的腾讯实习生笔试题,赶紧注册了个账号做题。题目描述:Given an input string, reverse the string word by word.For exam...
阅读全文

浙公网安备 33010602011771号