Domino Effect Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 8224 Accepted: 2068 Description Did you know that you can use domino bones for other things besides playing Dominoes? Take a number of dominoes and build a row by standing t…
Domino Effect Time Limit: 2 Seconds Memory Limit: 65536 KB Did you know that you can use domino bones for other things besides playing Dominoes? Take a number of dominoes and build a row by standing them on end with only a small distance in betw…
Domino Effect Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 12147 Accepted: 3046 Description Did you know that you can use domino bones for other things besides playing Dominoes? Take a number of dominoes and build a row by standing them…
This is a follow up of Shortest Word Distance. The only difference is now word1 could be the same as word2. Given a list of words and two words word1 and word2, return the shortest distance between these two words in the list. word1 and word2 may be…
This is a follow up of Shortest Word Distance. The only difference is now you are given the list of words and your method will be called repeatedly many times with different parameters. How would you optimize it? Design a class which receives a list…
Given a string S, you are allowed to convert it to a palindrome by adding characters in front of it. Find and return the shortest palindrome you can find by performing this transformation. For example: Given "aacecaaa", return "aaacecaaa&qu…
Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of which the sum ≥ s. If there isn't one, return 0 instead. For example, given the array [2,3,1,2,4,3] and s = 7,the subarray [4,3] has the minimal…
最短匹配应用于:假如有一段文本,你只想匹配最短的可能,而不是最长. 例子 比如有一段html片段,'\this is first label\\the second label\',如何匹配出每个a标签中的内容,下面来看下最短与最长的区别. 代码 >>> import re >>> str = '<a>this is first label</a><a>the second label</a>' >>>…
常用的 JavaScript 检测浏览器为 IE 是哪个版本的代码,包括是否是最人极端厌恶的 ie6 识别与检测. var isIE=!!window.ActiveXObject; var isIE6=isIE&&!window.XMLHttpRequest; var isIE8=isIE&&!!document.documentMode; var isIE7=isIE&&!isIE6&&!isIE8; if (isIE){ if (isIE…
These animations are more able to demostrate this plugin than the following static images. :) test 1: http://v.youku.com/v_show/id_XODM3NzA0NDcy.html test 2: http://v.youku.com/v_show/id_XODM3ODQwMDY4.html test 3: http://v.youku.com/v_show/id_XODM3OD…
25:最长最短单词 总时间限制: 1000ms 内存限制: 65536kB 描述 输入1行句子(不多于200个单词,每个单词长度不超过100),只包含字母.空格和逗号.单词由至少一个连续的字母构成,空格和逗号都是单词间的间隔. 试输出第1个最长的单词和第1个最短单词. 输入 一行句子. 输出 两行输出:第1行,第一个最长的单词.第2行,第一个最短的单词. 样例输入 I am studying Programming language C in Peking University 样例输出 P…
题目链接: 传送门 Domino Effect time limit per test:1 second memory limit per test:256 megabytes Description Little Chris knows there's no fun in playing dominoes, he thinks it's too random and doesn't require skill. Instead, he decided to play with the…
Shortest Prefixes Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 12731 Accepted: 5442 Description A prefix of a string is a substring starting at the beginning of the given string. The prefixes of "carbon" are: "c", &qu…
常用的 JavaScript 检测浏览器为 IE 是哪个版本的代码,包括是否是最人极端厌恶的 ie6 识别与检测.代码如下: var isIE=!!window.ActiveXObject; var isIE6=isIE&&!window.XMLHttpRequest; var isIE8=isIE&&!!document.documentMode; var isIE7=isIE&&!isIE6&&!isIE8; if (isIE){ if…