Lancher's re-code life
文章平均质量分 60
Lancher_Mo
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Easy-50
leetcode 541. Reverse String II Given a string and an integer k, you need to reverse the first k characters for every 2k characters counting from the start of the string. If there a原创 2017-05-22 16:44:24 · 479 阅读 · 0 评论 -
Easy-33
leetcode 387. First Unique Character in a StringGiven a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1.Examples: s = "leetcode"re原创 2017-05-08 09:46:10 · 328 阅读 · 0 评论 -
Easy-46
leetcode 350. Intersection of Two Arrays II Given two arrays, write a function to compute their intersection. Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return[2, 2]. No原创 2017-05-16 15:05:37 · 296 阅读 · 0 评论 -
Easy-45
leetcode 206. Reverse Linked List Reverse a singly linked list. 无头节点AC:/** * Definition for singly-linked list. * struct ListNode { * int val; * stru原创 2017-05-16 14:24:49 · 281 阅读 · 0 评论 -
Easy-32
leetcode 404. Sum of Left Leaves Find the sum of all left leaves in a given binary tree.Example: 3 / \ 9 20 / \ 15 7There are two left leaves in the binary tre原创 2017-05-08 00:00:46 · 330 阅读 · 0 评论 -
Easy-31
leetcode 383. Ransom Note Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the ransom note原创 2017-05-07 23:41:11 · 303 阅读 · 0 评论 -
Easy-30
leetcode 349. Intersection of Two Arrays Given two arrays, write a function to compute their intersection. Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return[2]. Note:原创 2017-05-07 23:30:24 · 334 阅读 · 0 评论 -
Easy-29
leetcode 453. Minimum Moves to Equal Array Elements Given a non-empty integer array of size n, find the minimum number of moves required to make all array elements equal, where a move原创 2017-05-07 23:04:31 · 317 阅读 · 0 评论 -
Easy-28
leetcode 455. Assign Cookies Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed fa原创 2017-05-07 21:31:13 · 276 阅读 · 0 评论 -
Easy-27
leetcode 167. Two Sum II - Input array is sorted Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number原创 2017-05-07 21:19:14 · 275 阅读 · 0 评论 -
Easy-26
leetcode 506. Relative Ranks Given scores of N athletes, find their relative ranks and the people with the top three highest scores, who will be awarded medals: "Gold Medal", "Silver Med原创 2017-05-07 21:05:53 · 264 阅读 · 0 评论 -
Easy-34
leetcode 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 dayi.Design an algorithm to find the maximum p原创 2017-05-08 10:31:55 · 304 阅读 · 0 评论 -
Easy-35
leetcode 171. Excel Sheet Column Number Related to question Excel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For原创 2017-05-08 10:50:59 · 285 阅读 · 0 评论 -
Easy-36
leetcode 237. Delete Node in a Linked ListWrite a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is 1 -> 2 -> 3 ->原创 2017-05-08 11:01:34 · 288 阅读 · 0 评论 -
Easy-49
leetcode 551. Student Attendance Record I You are given a string representing an attendance record for a student. The record only contains the following three characters:原创 2017-05-22 15:36:37 · 326 阅读 · 0 评论 -
Easy-48
leetcode 268. Missing Number Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array.For example,Given nums = [0, 1,原创 2017-05-22 15:20:36 · 449 阅读 · 0 评论 -
Easy-47
leetcode 447. Number of Boomerangs Given n points in the plane that are all pairwise distinct, a "boomerang" is a tuple of points(i, j, k) such that the distance between i and j e原创 2017-05-22 13:45:28 · 367 阅读 · 0 评论 -
Easy-43
leetcode 13. Roman to Integer Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.AC:int trans(char a){ int add;原创 2017-05-08 17:25:29 · 337 阅读 · 0 评论 -
Easy-42
leetcode 217. Contains DuplicateGiven 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 sh原创 2017-05-08 17:05:32 · 303 阅读 · 0 评论 -
Easy-41
leetcode 409. Longest PalindromeGiven a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters.This is case s原创 2017-05-08 16:54:44 · 698 阅读 · 0 评论 -
Easy-40
leetcode 504. Base 7 Given an integer, return its base 7 string representation.Example 1:Input: 100Output: "202"Example 2:Input: -7Output: "-10"Note: The input原创 2017-05-08 16:39:05 · 430 阅读 · 0 评论 -
Easy-39
leetcode 242. Valid AnagramGiven two strings s and t, write a function to determine if t is an anagram of s.For example,s = "anagram", t = "nagaram", return true.s = "rat", t = "car", ret原创 2017-05-08 11:59:48 · 297 阅读 · 0 评论 -
Easy-38
leetcode 169. Majority Element Given an array of size n, find the majority element. The majority element is the element that appearsmore than ⌊ n/2 ⌋ times.You may assume that the原创 2017-05-08 11:52:56 · 270 阅读 · 0 评论 -
Easy-37
leetcode 100. Same Tree Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical and the no原创 2017-05-08 11:25:30 · 327 阅读 · 0 评论 -
Easy-25
leetcode 530. Minimum Absolute Difference in BST Given a binary search tree with non-negative values, find the minimum absolute difference between values of any two nodes.Example:原创 2017-05-07 16:16:15 · 266 阅读 · 0 评论 -
Easy-24
leetcode 563. Binary Tree Tilt Given a binary tree, return the tilt of the whole tree.The tilt of a tree node is defined as the absolute difference between the sum of all left subtr原创 2017-05-06 16:48:46 · 358 阅读 · 0 评论 -
Easy-11
leetcode 292. Nim GameYou 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 t原创 2017-05-03 17:32:14 · 301 阅读 · 0 评论 -
Easy-10
leetcode 463. Island PerimeterYou are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/vertically (not d原创 2017-05-03 16:55:53 · 382 阅读 · 0 评论 -
Easy-9
You are given two arrays (without duplicates) nums1 andnums2 where nums1’s elements are subset of nums2. Find all the next greater numbers fornums1's elements in the corresponding places of nums2.原创 2017-05-03 16:31:51 · 395 阅读 · 0 评论 -
Easy-8
leetcode 344. Reverse String Write a function that takes a string as input and returns the string reversed.Example:Given s = "hello", return "olleh". AC:char* reverseString原创 2017-05-03 15:58:34 · 563 阅读 · 0 评论 -
Easy-7
leetcode 412. Fizz Buzz Write a program that outputs the string representation of numbers from 1 to n.But for multiples of three it should output “Fizz” instead of the number and for原创 2017-05-02 22:25:00 · 326 阅读 · 0 评论 -
Easy-6
leetcode 500. Keyboard RowGiven 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原创 2017-05-02 21:25:20 · 361 阅读 · 0 评论 -
Easy-5
leetcode 476. Number ComplementGiven a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation.Note:The given integer is gua原创 2017-05-02 20:24:58 · 286 阅读 · 0 评论 -
Easy-4
leetcode 557. Reverse Words in a String III Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial w原创 2017-05-02 17:14:53 · 356 阅读 · 0 评论 -
Easy-3
leetcode 566. Reshape the MatrixIn MATLAB, there is a very useful function called 'reshape', which can reshape a matrix into a new one with different size but keep its original data.You're gi原创 2017-05-02 13:04:54 · 401 阅读 · 1 评论 -
Easy-2
leetcode 461. Hamming Distance 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原创 2017-05-02 11:03:22 · 457 阅读 · 0 评论 -
Easy-12
leetcode 485. Max Consecutive Ones Given a binary array, find the maximum number of consecutive 1s in this array.Example 1:Input: [1,1,0,1,1,1]Output: 3Explanation: The first two原创 2017-05-03 17:38:53 · 327 阅读 · 0 评论 -
Easy-13
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原创 2017-05-03 18:30:05 · 385 阅读 · 0 评论 -
Easy-14
leetcode 520. Detect Capital Given a word, you need to judge whether the usage of capitals in it is right or not.We define the usage of capitals in a word to be right when one of the f原创 2017-05-03 18:41:36 · 270 阅读 · 0 评论 -
Easy-23
leetcode 492. Construct the Rectangle For a web developer, it is very important to know how to design a web page's size. So, given a specific rectangular web page’s area, your job by now原创 2017-05-06 16:25:08 · 371 阅读 · 0 评论
分享