![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode
oOCrowOo
这个作者很懒,什么都没留下…
展开
-
Leetcode-Algorithms Median of Two Sorted Arrays
There are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).Example 1: nums1 = [1, 3] num原创 2017-02-28 05:28:27 · 177 阅读 · 0 评论 -
Leetcode-Algorithms Two Sum
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 exactly one solution, and you may not use the same ele原创 2017-02-26 11:13:52 · 531 阅读 · 0 评论 -
Leetcode-Algorithms Nim Game
You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last stone will be the原创 2017-02-26 11:44:09 · 174 阅读 · 0 评论 -
Leetcode-Algorithms Hamming Distance(汉明距离)
从今天开始每天用python做几道leetcode的题目练手,从easy到hard递进。The Hamming distance between two integers is the number of positions at which the corresponding bits are different.Given two integers x and y, calculate the原创 2017-02-19 13:07:22 · 478 阅读 · 0 评论 -
Leetcode-Algorithms Number Complement(数字补码)
Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation.Note: The given integer is guaranteed to fit within the range of a 32-b原创 2017-02-20 01:36:54 · 214 阅读 · 0 评论 -
Leetcode-Algorithms Keyboard Row
Given a List of words, return the words that can be typed using letters of alphabet on only one row’s of American keyboard like the image below.Example 1: Input: [“Hello”, “Alaska”, “Dad”, “Peace”] O原创 2017-02-20 01:51:28 · 227 阅读 · 0 评论 -
Leetcode-Algorithms Nested List Weight Sum
Given a nested list of integers, return the sum of all integers in the list weighted by their depth.Each element is either an integer, or a list – whose elements may also be integers or other lists.Exa原创 2017-02-20 05:04:18 · 246 阅读 · 0 评论 -
Leetcode-Algorithms Next Greater Element I
You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1’s elements in the corresponding places of nums2.The原创 2017-02-20 12:45:05 · 162 阅读 · 0 评论 -
Leetcode-Algorithms Reverse String
Write a function that takes a string as input and returns the string reversed.Example: Given s = “hello”, return “olleh”.就是return一个反过来的string。class Solution(object): def reverseString(self, s):原创 2017-02-26 12:02:16 · 154 阅读 · 0 评论 -
Leetcode-Algorithms Single Number
Given an array of integers, every element appears twice except for one. Find that single one.Note: Your algorithm should have a linear runtime complexity. Could you implement it without using extra me原创 2017-02-26 12:26:07 · 179 阅读 · 0 评论 -
Leetcode-Algorithms 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 it原创 2017-02-27 07:33:56 · 212 阅读 · 0 评论