摘要:
Description:Count the number of prime numbers less than a non-negative number,nclick to show more hints.References:How Many Primes Are There?Sieve of ... 阅读全文
摘要:
这题居然没有记录,写一下吧:Given a set of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Thesa... 阅读全文
摘要:
Remove all elements from a linked list of integers that have valueval.ExampleGiven:1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6,val= 6Return:1 --> 2 --> 3 --... 阅读全文
摘要:
1 class Solution { 2 public: 3 bool isHappy(int n) { 4 int last = n; 5 6 unordered_set exist; 7 8 do { ... 阅读全文
摘要:
虽然叫nc不过用起来非常方便。选项 -4 Use IPv4 only -6 Use IPv6 only -U, --unixsock... 阅读全文
摘要:
这个题居然没有记录。原地旋转数组可以见编程珠玑,在JDK代码中也可以找到(Collections.rotate),提供了两种方式一种是做三次reverse,还有一种则是进行遍历替换。第一种方式: 1 class Solution { 2 public: 3 void rotate(int n... 阅读全文
摘要:
1 class Solution { 2 public: 3 int majorityElement(vector &num) { 4 int candidate = num[0]; 5 int count = 1; 6 int len = ... 阅读全文
摘要:
1 class Solution { 2 private: 3 char tbl[256]; 4 public: 5 vector findRepeatedDnaSequences(string s) { 6 vector res; 7 8 ... 阅读全文
摘要:
tr命令可以用来做简单的字符替换与删除,常用的有-d, -s选项。它的替换与删除是按单个字符来的假设有以下文本:Read from the file words.txt and output the word frequency list to stdout.USE CASE 1:将文本全部转化为大... 阅读全文
摘要:
NAME uniq - report or omit repeated linesSYNOPSIS uniq [OPTION]... [INPUT [OUTPUT]]DESCRIPTION Filter adjacent matching lines from I... 阅读全文