![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode刷题记录
mOBSENCE11
这个作者很懒,什么都没留下…
展开
-
leet code2 Add Two Numbers
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return i...原创 2018-03-15 13:42:53 · 255 阅读 · 0 评论 -
leetcode 1 Two Sum
Given nums = [2, 7, 11, 15], target = 9,Because nums[0] + nums[1] = 2 + 7 = 9,return [0, 1]//给定一个数组与目标值,使列表中两数相加等于目标值,返回值为两数在列表中的位置。class Solution(object): def twoSum(self, nums, target): ...原创 2018-03-05 09:19:25 · 259 阅读 · 0 评论 -
leetcode 9 Palindrome Number
判断一个整形变量是否是回文数。class Solution(object): def isPalindrome(self, x): """ :type x: int :rtype: bool """ a = str(x) return(a==a[::-1])//str[a:-b:c]表示输出字符串从a位置开始...原创 2018-03-05 10:36:41 · 170 阅读 · 0 评论 -
leetcode 7 Reverse Integer
Given a 32-bit signed integer, reverse digits of an integer.Example 1:Input: 123Output: 321Example 2:Input: -123Output: -321Example 3:Input: 120Output: 21//给出一个32位有符号整形变量,对这个整形变量进行反转//由于我把整形转为字符...原创 2018-03-05 10:09:01 · 173 阅读 · 0 评论 -
26.Remove Duplicates from Sorted Array
Given a sorted array, remove the duplicates in-place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this by modifying the ...原创 2018-03-23 11:28:52 · 159 阅读 · 0 评论 -
122. Best Time to Buy and Sell Stock II
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 complete as many transactions as you like (ie, buy one an...原创 2018-03-23 11:43:25 · 211 阅读 · 1 评论 -
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,6,7,1,2,3,4]. Note:Try to come up as many solutions as you can, ther...原创 2018-03-23 12:02:17 · 198 阅读 · 0 评论 -
217. Contains Duplicate
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 array, and it should return false if every element is...原创 2018-03-23 14:31:39 · 159 阅读 · 0 评论