![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode
文章平均质量分 70
Jessica_oO
这个作者很懒,什么都没留下…
展开
-
LeetCode (Easy Part) Palindrome Number
题目:Determine whether an integer is a palindrome. Do this without extra space.确定整数是否是回文。 这样做没有额外的空间。思路: 此题是来判断一个数是否是回文数。首先,什么是回文数,下面给出回文数的定义。设n是一任意自然数。若将n的各位数字反向排列所得自然数n1与n相等,则称n为一回文数。例如,若n=1234...原创 2018-04-08 20:16:43 · 120 阅读 · 0 评论 -
No67. Add Binary(Python)
题目:Given two binary strings, return their sum (also a binary string).The input strings are both non-empty and contains only characters 1 or 0.Example 1:Input: a = "11", b = "1"Output: "100"Example 2:...原创 2018-05-04 20:33:41 · 322 阅读 · 0 评论 -
No35.Search Insert Position(查找插入位置)(Python)
题目: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 in order.You may assume no duplicates in the array. ...原创 2018-04-25 22:46:51 · 311 阅读 · 0 评论 -
No47. Permutations II(Python)
题目:Given a collection of numbers that might contain duplicates, return all possible unique permutations.Example:Input: [1,1,2]Output:[ [1,1,2], [1,2,1], [2,1,1]]思路: 这道题目和上一道题目有点类似,相当于它的升级...原创 2018-05-02 20:15:25 · 402 阅读 · 0 评论 -
No46. Permutations 排列 (Python)
题目:Given a collection of distinct integers, return all possible permutations.Example:Input: [1,2,3]Output:[ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1]]代码:class Solution(objec...原创 2018-05-01 22:35:03 · 267 阅读 · 0 评论 -
N0374. Guess Number Higher or Lower(Python)
题目: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 wrong, I'll tell you whether the number is higher or ...原创 2018-05-01 10:21:09 · 696 阅读 · 0 评论 -
N0278. First Bad Version(Python)
题目:You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on ...原创 2018-04-30 22:02:44 · 676 阅读 · 0 评论 -
LeetCode (Easy Part) Reverse Integer
题目:Given a 32-bit signed integer, reverse digits of an integer.给定一个32位有符号整数,整数的反转数字。Example 1:Input: 123Output: 321Example 2:Input: -123Output: -321Example 3:Input: 120Output: 21Note: Assum...原创 2018-04-06 11:27:22 · 168 阅读 · 0 评论 -
LeetCode (Easy Part) Valid Parentheses
问题:Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.给定一个只包含字符'(',')','{','}','['和']'的字符串,确定输入字符串是否有效。The brackets must close in the...原创 2018-04-06 10:04:05 · 174 阅读 · 1 评论 -
LeetCode (Easy Part) Two Sum
No1. TwoSum题目:Given an array of integers, return indices of the two numbers such that they add up to a specific target.给定一个整数数组,返回这两个数字的索引,使它们合计成一个特定的目标。You may assume that each input would have exact...原创 2018-04-05 19:22:24 · 142 阅读 · 0 评论 -
NO14. Longest Common Prefix (Easy) (Java)
题目:Write a function to find the longest common prefix string amongst an array of strings.编写一个函数来查找字符串数组中最长的公共前缀字符串。思路:首先,以字符串数组的第一个字符为基准,依次判断之后的字符与第一个字符公共字符的位数。取最小的位数,即公共字符串的位数。再用Substring()方法从第一个字符串中...原创 2018-04-12 11:29:47 · 124 阅读 · 0 评论 -
Merge Two Sorted Lists (Java)
题目:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.Example:Input: 1->2->4, 1->3->4Output: 1-&g...原创 2018-04-11 22:47:22 · 125 阅读 · 0 评论 -
No70. Climbing Stairs(Python)
题目: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 you climb to the top?Note: Given n will be a positive ...原创 2018-05-12 09:09:31 · 413 阅读 · 0 评论