随笔分类 -  LeetCode

上一页 1 ··· 8 9 10 11 12 13 14 下一页
摘要: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", "Sil 阅读全文
posted @ 2017-07-16 15:39 immjc 阅读(164) 评论(0) 推荐(0)
摘要:Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1. Examples: Note: You may assume the 阅读全文
posted @ 2017-07-16 14:58 immjc 阅读(103) 评论(0) 推荐(0)
摘要: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 comple 阅读全文
posted @ 2017-07-16 14:41 immjc 阅读(129) 评论(0) 推荐(0)
摘要:Given an array consisting of n integers, find the contiguous subarray of given length k that has the maximum average value. And you need to output the 阅读全文
posted @ 2017-07-16 13:38 immjc 阅读(178) 评论(0) 推荐(0)
摘要:Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example: 给定一个整数,求出其在Excel对应的字母标题,利用while循环,先对整数取余(n - 阅读全文
posted @ 2017-07-16 12:21 immjc 阅读(160) 评论(0) 推荐(0)
摘要: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-07-16 11:41 immjc 阅读(176) 评论(0) 推荐(0)
摘要:Find the sum of all left leaves in a given binary tree. Example: 3 / \ 9 20 / \ 15 7 There are two left leaves in the binary tree, with values 9 and 1 阅读全文
posted @ 2017-07-15 21:19 immjc 阅读(163) 评论(0) 推荐(0)
摘要: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 subt 阅读全文
posted @ 2017-07-15 17:19 immjc 阅读(146) 评论(0) 推荐(0)
摘要:Given a binary search tree with non-negative values, find the minimum absolute difference between values of any two nodes. Example: Note: There are at 阅读全文
posted @ 2017-07-15 16:42 immjc 阅读(138) 评论(0) 推荐(0)
摘要:Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the rans 阅读全文
posted @ 2017-07-15 16:14 immjc 阅读(212) 评论(0) 推荐(0)
摘要:Given two arrays, write a function to compute their intersection. Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2]. Note: Each element i 阅读全文
posted @ 2017-07-14 11:22 immjc 阅读(133) 评论(0) 推荐(0)
摘要: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 g 阅读全文
posted @ 2017-07-14 10:35 immjc 阅读(122) 评论(0) 推荐(0)
摘要: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. The function 阅读全文
posted @ 2017-07-13 22:05 immjc 阅读(141) 评论(0) 推荐(0)
摘要: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 incrementing n  阅读全文
posted @ 2017-07-13 21:34 immjc 阅读(166) 评论(0) 推荐(0)
摘要:Suppose Andy and Doris want to choose a restaurant for dinner, and they both have a list of favorite restaurants represented by strings. You need to h 阅读全文
posted @ 2017-07-13 17:20 immjc 阅读(318) 评论(0) 推荐(0)
摘要: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 repres 阅读全文
posted @ 2017-07-13 16:05 immjc 阅读(142) 评论(0) 推荐(0)
摘要: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 i 阅读全文
posted @ 2017-07-13 11:35 immjc 阅读(142) 评论(0) 推荐(0)
摘要:Solve a given equation and return the value of x in the form of string "x=#value". The equation contains only '+', '-' operation, the variable x and i 阅读全文
posted @ 2017-07-12 22:39 immjc 阅读(242) 评论(0) 推荐(0)
摘要: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-07-12 12:17 immjc 阅读(108) 评论(0) 推荐(0)
摘要: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 like: 阅读全文
posted @ 2017-07-12 12:01 immjc 阅读(109) 评论(0) 推荐(0)

上一页 1 ··· 8 9 10 11 12 13 14 下一页