摘要:
Given an array consisting of n integers, find the contiguous subarray whose length is greater than or equal to k that has the maximum average value. A
阅读全文
posted @ 2017-12-11 06:41
Grandyang
阅读(12410)
推荐(1)
摘要:
Given two sentences words1, words2 (each represented as an array of strings), and a list of similar word pairs pairs, determine if two sentences are s
阅读全文
posted @ 2017-12-10 09:42
Grandyang
阅读(6585)
推荐(0)
摘要:
Implement a MyCalendarThree class to store your events. A new event can always be added. Your class will have one method, book(int start, int end). Fo
阅读全文
posted @ 2017-12-08 13:53
Grandyang
阅读(5064)
推荐(1)
摘要:
在使用python爬虫提取中文网页的内容,为了能正确显示中文的内容,在转为字符串时一定要声明编码为utf-8,否则无法正常显示中文,而是显示原编码的字符,并没有正确转换。比如下面这个简单的爬取百度页面的title的示例: 如果不在tostring函数中正确配置的话,会打印出: 而正确的应该是:
阅读全文
posted @ 2017-12-06 01:36
Grandyang
阅读(5762)
推荐(1)
摘要:
An image is represented by a 2-D array of integers, each integer representing the pixel value of the image (from 0 to 65535). Given a coordinate (sr,
阅读全文
posted @ 2017-12-05 23:23
Grandyang
阅读(11229)
推荐(0)
摘要:
Implement a MyCalendarTwo class to store your events. A new event can be added if adding the event will not cause a triple booking. Your class will ha
阅读全文
posted @ 2017-12-03 23:50
Grandyang
阅读(8468)
推荐(1)
摘要:
Given a string S, find the number of different non-empty palindromic subsequences in S, and return that number modulo 10^9 + 7. A subsequence of a str
阅读全文
posted @ 2017-12-01 14:13
Grandyang
阅读(7571)
推荐(0)
摘要:
Implement a MyCalendar class to store your events. A new event can be added if adding the event will not cause a double booking. Your class will have
阅读全文
posted @ 2017-11-29 14:14
Grandyang
阅读(7449)
推荐(1)
摘要:
A self-dividing number is a number that is divisible by every digit it contains. For example, 128 is a self-dividing number because 128 % 1 == 0, 128
阅读全文
posted @ 2017-11-27 23:55
Grandyang
阅读(4491)
推荐(0)
摘要:
Design a search autocomplete system for a search engine. Users may input a sentence (at least one word and end with a special character '#'). For each
阅读全文
posted @ 2017-11-25 23:56
Grandyang
阅读(12460)
推荐(0)
摘要:
Given a (singly) linked list with head node root, write a function to split the linked list into k consecutive linked list "parts". The length of each
阅读全文
posted @ 2017-11-22 12:04
Grandyang
阅读(5104)
推荐(1)
摘要:
下面是iOS开发用第三方库可能出现的错误,及其解决方法: 1. 'NSInvalidArgumentException', reason: '-[UITableView mas_makeConstraints:]: unrecognized selector sent to instance 0x7
阅读全文
posted @ 2017-11-21 13:08
Grandyang
阅读(5323)
推荐(0)
摘要:
Given an array of integers nums, write a method that returns the "pivot" index of this array. We define the pivot index as the index where the sum of
阅读全文
posted @ 2017-11-20 12:08
Grandyang
阅读(5561)
推荐(0)
摘要:
This question is about implementing a basic elimination algorithm for Candy Crush. Given a 2D integer array board representing the grid of candy, diff
阅读全文
posted @ 2017-11-18 23:40
Grandyang
阅读(12148)
推荐(1)
摘要:
Given a C++ program, remove comments from it. The program source is an array where source[i] is the i-th line of the source code. This represents the
阅读全文
posted @ 2017-11-15 23:58
Grandyang
阅读(6084)
推荐(0)
摘要:
Given a list accounts, each element accounts[i] is a list of strings, where the first element accounts[i][0] is a name, and the rest of the elements a
阅读全文
posted @ 2017-11-13 23:52
Grandyang
阅读(14918)
推荐(0)
摘要:
Design a max stack that supports push, pop, top, peekMax and popMax. push(x) -- Push element x onto stack. pop() -- Remove the element on top of the s
阅读全文
posted @ 2017-11-12 22:56
Grandyang
阅读(16267)
推荐(0)
摘要:
Given a list of strings words representing an English Dictionary, find the longest word in words that can be built one character at a time by other wo
阅读全文
posted @ 2017-11-10 23:52
Grandyang
阅读(7201)
推荐(0)
摘要:
Given two integer arrays A and B, return the maximum length of an subarray that appears in both arrays. Example 1: Input: A: [1,2,3,2,1] B: [3,2,1,4,7
阅读全文
posted @ 2017-11-07 22:37
Grandyang
阅读(10407)
推荐(0)
摘要:
We have two special characters. The first character can be represented by one bit 0. The second character can be represented by two bits (10 or 11). N
阅读全文
posted @ 2017-11-05 23:57
Grandyang
阅读(5673)
推荐(0)
摘要:
在使用Visual Studio进行项目开发的时候,有时候会遇到下面这个错误: Unhandled exception at 0x00905a4d in xxx.exe: 0xC0000005: Access violation 产生这个错误的原因可能是在Visual Studio中链接了后缀为"*
阅读全文
posted @ 2017-11-04 00:54
Grandyang
阅读(1512)
推荐(0)
摘要:
Your are given an array of integers prices, for which the i-th element is the price of a given stock on day i; and a non-negative integer fee represen
阅读全文
posted @ 2017-11-03 10:29
Grandyang
阅读(9734)
推荐(1)
摘要:
在用VS开发项目的时候,我们可以将不同的模块拆分开来,分别建立单独的Project来开发调试,整个放到一个Solution中就行了。这样做的好处是结构清晰,每个功能模块可以单独调试,而不用编译整个Solution,尤其当项目很大的时候,能节省很多编译时间。而且各个项目之间相互独立,对于每个模块,我们
阅读全文
posted @ 2017-11-01 11:32
Grandyang
阅读(890)
推荐(0)
摘要:
Your are given an array of positive integers nums. Count and print the number of (contiguous) subarrays where the product of all the elements in the s
阅读全文
posted @ 2017-10-30 12:32
Grandyang
阅读(8743)
推荐(1)
摘要:
Given two strings s1, s2, find the lowest ASCII sum of deleted characters to make two strings equal. Example 1: Input: s1 = "sea", s2 = "eat" Output:
阅读全文
posted @ 2017-10-29 23:50
Grandyang
阅读(5759)
推荐(1)
摘要:
There are some trees, where each tree is represented by (x,y) coordinate in a two-dimensional garden. Your job is to fence the entire garden using the
阅读全文
posted @ 2017-10-27 23:54
Grandyang
阅读(4619)
推荐(0)
摘要:
3D Slicer Reconstruct CT/MRI 1. Load DCM file of your CT/MRI 2. Go to Volume Rendering, click the eye button to show volume 3. Go to Editor -> Thresho
阅读全文
posted @ 2017-10-26 23:58
Grandyang
阅读(1076)
推荐(0)
摘要:
Given an integer array nums and an integer k, return true if it is possible to divide this array into k non-empty subsets whose sums are all equal. Ex
阅读全文
posted @ 2017-10-25 23:38
Grandyang
阅读(17763)
推荐(1)
摘要:
Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements. Your t
阅读全文
posted @ 2017-10-24 12:39
Grandyang
阅读(8645)
推荐(1)
摘要:
Give a string s, count the number of non-empty (contiguous) substrings that have the same number of 0's and 1's, and all the 0's and all the 1's in th
阅读全文
posted @ 2017-10-23 12:25
Grandyang
阅读(6325)
推荐(0)
摘要:
Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) Yo
阅读全文
posted @ 2017-10-22 23:51
Grandyang
阅读(9940)
推荐(0)
摘要:
Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) Yo
阅读全文
posted @ 2017-10-20 11:53
Grandyang
阅读(17550)
推荐(0)
摘要:
Given a positive integer, check whether it has alternating bits: namely, if two adjacent bits will always have different values. Example 1: Input: 5 O
阅读全文
posted @ 2017-10-19 23:51
Grandyang
阅读(4095)
推荐(1)
摘要:
Given a non-empty list of words, return the k most frequent elements. Your answer should be sorted by frequency from highest to lowest. If two words h
阅读全文
posted @ 2017-10-18 23:52
Grandyang
阅读(12949)
推荐(0)
摘要:
Error: nafxcw.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new[](unsigned int)" (??_U@YAPAXI@Z) already defined in libcpmt.lib(newaop.obj
阅读全文
posted @ 2017-10-17 06:48
Grandyang
阅读(1655)
推荐(1)
摘要:
Given a sorted array consisting of only integers where every element appears twice except for one element which appears once. Find this single element
阅读全文
posted @ 2017-10-16 21:42
Grandyang
阅读(6151)
推荐(0)
摘要:
How would you design a URL shortening service that is similar to TinyURL? Background:TinyURL is a URL shortening service where you enter a URL such as
阅读全文
posted @ 2017-10-15 23:51
Grandyang
阅读(6221)
推荐(0)
摘要:
You are given coins of different denominations and a total amount of money. Write a function to compute the number of combinations that make up that a
阅读全文
posted @ 2017-10-14 23:47
Grandyang
阅读(16471)
推荐(1)
摘要:
There are 1000 buckets, one and only one of them contains poison, the rest are filled with water. They all look the same. If a pig drinks that poison
阅读全文
posted @ 2017-10-13 23:45
Grandyang
阅读(6937)
推荐(0)
摘要:
You are given a circular array nums of positive and negative integers. If a number k at an index is positive, then move forward k steps. Conversely, i
阅读全文
posted @ 2017-10-12 21:09
Grandyang
阅读(10479)
推荐(0)