上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 27 下一页
摘要: Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.求一字符串在另一字符串中第一次出现的位置class Solution(object): def strStr(self, haystack, ne... 阅读全文
posted @ 2017-08-02 23:18 xiejunzhao 阅读(128) 评论(0) 推荐(0)
摘要: Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here a k-diff pair is defined as an integer pair (i, j), where i and j are both numbers in... 阅读全文
posted @ 2017-08-01 22:13 xiejunzhao 阅读(478) 评论(0) 推荐(0)
摘要: Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() -- Get the ... 阅读全文
posted @ 2017-07-31 23:05 xiejunzhao 阅读(235) 评论(0) 推荐(0)
摘要: Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.Example:Given nums = [-2, 0, 3, -5, 2, -1] sumRange(0, 2) -> 1 sumRange(2, 5) -> -1 sumRange(0, 5)... 阅读全文
posted @ 2017-07-31 23:05 xiejunzhao 阅读(301) 评论(0) 推荐(0)
摘要: Given an integer array, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole array will be sorted in ascending order, too.You need to find th... 阅读全文
posted @ 2017-07-26 23:17 xiejunzhao 阅读(440) 评论(0) 推荐(0)
摘要: The set S originally contains numbers from 1 to n. But unfortunately, due to the data error, one of the numbers in the set got duplicated to another number in the set, which results in repetition of o... 阅读全文
posted @ 2017-07-24 00:01 xiejunzhao 阅读(456) 评论(0) 推荐(0)
摘要: Suppose you have a long flowerbed in which some of the plots are planted and some are not. However, flowers cannot be planted in adjacent plots - they would compete for water and both would die.Given ... 阅读全文
posted @ 2017-07-22 17:49 xiejunzhao 阅读(255) 评论(0) 推荐(0)
摘要: 工作中时常需要把EXML代码中声明的组件编写到ts文件中,耗时耗力。因此编写一个小工具,自动生成组件声明代码。 工具代码如下:var fs = require("fs")var readline = require('readline');var rl = readline.createInterface(process.stdin, process.stdout); var input = ""... 阅读全文
posted @ 2017-07-22 00:35 xiejunzhao 阅读(765) 评论(0) 推荐(0)
摘要: Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ...Note:n is positive and will fit within the range of a 32-bit signed integer (n < 231).Example 1:Input:3Output:... 阅读全文
posted @ 2017-07-18 22:57 xiejunzhao 阅读(165) 评论(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 maximum average value.Example 1:Input: [1,12,-5,-... 阅读全文
posted @ 2017-07-16 18:24 xiejunzhao 阅读(277) 评论(0) 推荐(0)
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 27 下一页