随笔分类 -  LeetCode

LeetCode: 171 Excel Sheet Column Number(easy)
摘要:题目: Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, return its corresponding column number. For example 阅读全文

posted @ 2017-09-14 21:14 玲珑子 阅读(165) 评论(0) 推荐(0)

LeetCode: 453 Minimum Moves to Equal Array Elements(easy)
摘要:题目: 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 is incrementin 阅读全文

posted @ 2017-09-14 21:12 玲珑子 阅读(98) 评论(0) 推荐(0)

LeetCode: 455 Assign Cookies(easy)
摘要:题目: 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 阅读全文

posted @ 2017-09-11 21:57 玲珑子 阅读(137) 评论(0) 推荐(0)

LeetCode: 383 Ransom Note(easy)
摘要:题目: Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the 阅读全文

posted @ 2017-09-11 20:55 玲珑子 阅读(89) 评论(0) 推荐(0)

LeetCode: 171 Excel Sheet Column Number(easy)
摘要:题目: Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, return its corresponding column number. For example 阅读全文

posted @ 2017-09-09 17:15 玲珑子 阅读(93) 评论(0) 推荐(0)

LeetCode: 598 Range Addition II(easy)
摘要:题目: Given an m * n matrix M initialized with all 0's and several update operations. Operations are represented by a 2D array, and each operation is re 阅读全文

posted @ 2017-09-06 10:43 玲珑子 阅读(261) 评论(0) 推荐(0)

LeetCode: 492 Construct the Rectangle(easy)
摘要:题目: or 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 no 阅读全文

posted @ 2017-09-06 10:26 玲珑子 阅读(130) 评论(0) 推荐(0)

LeetCode: 283 Move Zeroes(easy)
摘要:题目: Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. For example, 阅读全文

posted @ 2017-09-05 21:54 玲珑子 阅读(142) 评论(0) 推荐(0)

LeetCode: 389 Find the Difference(easy)
摘要:题目: Given two strings s and t which consist of only lowercase letters. String t is generated by random shuffling string s and then add one more letter 阅读全文

posted @ 2017-09-05 11:14 玲珑子 阅读(140) 评论(0) 推荐(0)

LeetCode: 669 Trim a Binary Search Tree(easy)
摘要:题目: Given a binary search tree and the lowest and highest boundaries as L and R, trim the tree so that all its elements lies in [L, R] (R >= L). You m 阅读全文

posted @ 2017-09-05 10:57 玲珑子 阅读(195) 评论(0) 推荐(0)

LeetCode: 371 Sum of Two Integers(easy)
摘要:题目: Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -. Example:Given a = 1 and b = 2, return 3. 代码: 使用移位来 阅读全文

posted @ 2017-08-31 10:40 玲珑子 阅读(84) 评论(0) 推荐(0)

LeetCode: 258 Add Digits(easy)
摘要:题目: Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the process is l 阅读全文

posted @ 2017-08-29 17:47 玲珑子 阅读(93) 评论(0) 推荐(0)

LeetCode: 448 Find All Numbers Disappeared in an Array(easy)
摘要:题目: Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, 阅读全文

posted @ 2017-08-29 17:12 玲珑子 阅读(124) 评论(0) 推荐(0)

LeetCode: 226 Invert Binary Tree(easy)
摘要:题目: Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9 6 3 1 代码: Invert a binary tree. 自己的(递归实现): 别人的: 自己的(使用队列,非递归实现): 非递归和递归的在Le 阅读全文

posted @ 2017-08-28 20:04 玲珑子 阅读(83) 评论(0) 推荐(0)

LeetCode: 520 Detect Capital(easy)
摘要:题目: 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 on 阅读全文

posted @ 2017-08-28 16:26 玲珑子 阅读(104) 评论(0) 推荐(0)

LeetCode: 485 Max Consecutive Ones(easy)
摘要:题目: Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Note: The input array will only contain 0 and 1. The len 阅读全文

posted @ 2017-08-28 09:38 玲珑子 阅读(136) 评论(0) 推荐(0)

LeetCode: 136 Single Number(easy)
摘要:题目: Given an array of integers, every element appears twice except for one. Find that single one. Note:Your algorithm should have a linear runtime com 阅读全文

posted @ 2017-08-26 11:36 玲珑子 阅读(140) 评论(0) 推荐(0)

LeetCode: 292 Nim Game(easy)
摘要:题目: 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 阅读全文

posted @ 2017-08-26 10:52 玲珑子 阅读(96) 评论(0) 推荐(0)

LeetCode: 521 Longest Uncommon Subsequence I(easy)
摘要:题目: anysubsequence of the other strings. A subsequence is a sequence that can be derived from one sequence by deleting some characters without changin 阅读全文

posted @ 2017-08-26 09:32 玲珑子 阅读(126) 评论(0) 推荐(0)

LeetCode: 637 Average of Levels in Binary Tree
摘要:题目: Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array. Example 1: Input: 3 / \ 9 20 / \ 15 7 阅读全文

posted @ 2017-08-24 22:38 玲珑子 阅读(130) 评论(0) 推荐(0)

导航