随笔分类 -  LeetCode

上一页 1 ··· 7 8 9 10 11 12 下一页
摘要: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, n] 阅读全文
posted @ 2017-07-10 13:01 __Meng 阅读(163) 评论(0) 推荐(0)
摘要:In 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. 阅读全文
posted @ 2017-07-08 20:37 __Meng 阅读(147) 评论(0) 推荐(0)
摘要:Given an integer array, find three numbers whose product is maximum and output the maximum product. Example 1: Input: [1,2,3] Output: 6 Example 2: Inp 阅读全文
posted @ 2017-07-06 13:33 __Meng 阅读(151) 评论(0) 推荐(0)
摘要:Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: 阅读全文
posted @ 2017-07-04 13:50 __Meng 阅读(127) 评论(0) 推荐(0)
摘要:Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of 阅读全文
posted @ 2017-07-01 13:20 __Meng 阅读(136) 评论(0) 推荐(0)
摘要:You are given a string representing an attendance record for a student. The record only contains the following three characters: A student could be re 阅读全文
posted @ 2017-06-19 19:02 __Meng 阅读(177) 评论(0) 推荐(0)
摘要:Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order. E 阅读全文
posted @ 2017-06-04 20:35 __Meng 阅读(168) 评论(0) 推荐(0)
摘要:Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. You may a 阅读全文
posted @ 2017-04-02 00:08 __Meng 阅读(153) 评论(0) 推荐(0)
摘要: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 ar 阅读全文
posted @ 2017-03-31 12:47 __Meng 阅读(139) 评论(0) 推荐(0)
摘要:The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ... 1 is read off as "one 1" or 11.11 is read off 阅读全文
posted @ 2017-03-29 19:55 __Meng 阅读(148) 评论(0) 推荐(0)
摘要:Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. The brackets must close in the 阅读全文
posted @ 2017-03-26 22:53 __Meng 阅读(120) 评论(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-03-25 19:37 __Meng 阅读(130) 评论(0) 推荐(0)
摘要:Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. Subscribe to see which companies asked thi 阅读全文
posted @ 2017-03-17 16:12 __Meng 阅读(134) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2017-03-14 21:27 __Meng 阅读(129) 评论(0) 推荐(0)
摘要:Write 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 - 阅读全文
posted @ 2017-03-13 23:00 __Meng 阅读(138) 评论(0) 推荐(0)
摘要:Given a column title as appear in an Excel sheet, return its corresponding column number. For example: C++(3ms): 阅读全文
posted @ 2017-03-12 13:49 __Meng 阅读(158) 评论(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: C++(106ms): 使用unordered_ 阅读全文
posted @ 2017-03-09 17:17 __Meng 阅读(190) 评论(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-03-08 22:57 __Meng 阅读(160) 评论(0) 推荐(0)
摘要:Find the sum of all left leaves in a given binary tree. Example: C++(6ms): C++: 阅读全文
posted @ 2017-03-07 14:39 __Meng 阅读(97) 评论(0) 推荐(0)
摘要:Given an integer, return its base 7 string representation. Example 1: Example 2: Java(15ms): 把一个6进制的数转成7进制 public String convertToBase7(int num) { ret 阅读全文
posted @ 2017-03-05 23:01 __Meng 阅读(156) 评论(0) 推荐(0)

上一页 1 ··· 7 8 9 10 11 12 下一页