n*****n 发帖数: 567 | 1 表彰 odesolver,ele, hcping
使本版的文章第一次上了十大
同志们在兵力缺少,粮草不足的情况
顽强拼搏,持之以恒,坚韧不拔
以无产阶级大无畏的革命精神和
英雄气概排除千难万险,努力攻关,
填补本版的一项纪录空白
特此表彰,以此鼓励
并在此向所有关心和支持LZU的虫子们表示
衷心的感谢!
Merry Christmas & Happy New Year! |
|
p*****2 发帖数: 21240 | 2 写了一个BFS的。
class Node
{
int value;
Node left;
Node right;
public Node(int v)
{
value = v;
}
}
class Ele
{
int min;
int max;
Node ref;
public Ele(int _min, int _max, Node _ref)
{
min = _min;
max = _max;
ref = _ref;
}
}
Node convert(ArrayList> tree)
{
Queue queue = new LinkedList();
... 阅读全帖 |
|
L******k 发帖数: 395 | 3 my solution:
#include
#include
#include
#include
#include
#include
#include
using namespace std;
void jf_eval(string& in_line, unordered_map
>>& record)
{
int i_dex = in_line.find_first_of(' ');
string cur_var = in_line.substr(0, i_dex);
vector varibles;
int cur_value = 0, ele = 0;
bool new_variable = true, new_number = true; int index1 = 0;
int i = i_dex... 阅读全帖 |
|
j*****n 发帖数: 23 | 4 #include
#include
#include
#include
#include
#include
#include
using namespace std; //这个最好解释一下不会真的在production上这么写
void jf_eval(string& in_line, unordered_map
//jf 是什么意思?
>>& record)
{
int i_dex = in_line.find_first_of(' ');
string cur_var = in_line.substr(0, i_dex);
vector varibles;
int cur_value = 0, ele = 0;
bool new_variable = true, new_number = true; int ... 阅读全帖 |
|
C****t 发帖数: 53 | 5 一个hashtable就好, key为元素,value为两个数【重复次数,visited的状态】
def total(nums, tar):
maps = {}
res = 0
for ele in nums:
if ele not in maps:
maps[ele] = [1,0]
else:
maps[ele][0] += 1
for ele in nums:
if maps[ele][1] = 1: continue
diff = tar - ele
if diff not in maps: continue
rep1, rep2 = maps[ele][0], maps[diff][0]
if ele == diff and rep1 > 1:
res += rep1*(rep1-1)//2
elif ele != diff:
... 阅读全帖 |
|
p*****2 发帖数: 21240 | 6 写了一个N^2的。
public int maximalRectangle(char[][] matrix)
{
if(matrix==null || matrix.length==0)
return 0;
int m=matrix.length;
int n=matrix[0].length;
int[] height=new int[n];
int max=0;
for(int i=0;i
{
for(int j=0;j
if(matrix[i][j]=='1')
height[j]++;
else
height[j]=0;
max=Math.max(max,la... 阅读全帖 |
|
m*****n 发帖数: 204 | 7
public class ElementsImpl implements IElements {
private final int batchSize;
private final AtomicInteger counter = new AtomicInteger();
ElementsImpl(int i) {
batchSize = i;
}
public int getBatchSize() {
return batchSize;
}
@Override
public void inc() {
counter.incrementAndGet();
}
@Override
public boolean reserve() {
int val = co... 阅读全帖 |
|
m*****n 发帖数: 204 | 8
public class ElementsImpl implements IElements {
private final int batchSize;
private final AtomicInteger counter = new AtomicInteger();
ElementsImpl(int i) {
batchSize = i;
}
public int getBatchSize() {
return batchSize;
}
@Override
public void inc() {
counter.incrementAndGet();
}
@Override
public boolean reserve() {
int val = co... 阅读全帖 |
|
c*******t 发帖数: 1095 | 9 O(n^2)下面这段code有反例么? 没想出来反例
谢
for(each ele in the sorted array)
{
ele = arr[i] - k;
let front be the pointer to the front of the array;
let rear be the pointer to the rear element of the array.;
// till front is not greater than rear.
while(front <= rear)
{
if(*front *rear == ele)
{
print "Found triplet "<<*front<<","<<*rear<<","<
break;
}
else
{
// sum is > ele, so ... 阅读全帖 |
|
|
s*****n 发帖数: 994 | 11 不知道什么地方可以改进?请有时间的朋友指点一下
combinationsum1用类似的办法就没超时
class Solution {
public:
vector > combinationSum2(vector &num, int target) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
sort (num.begin(), num.end());
vector > results(0);
addOneBit(num, target, results);
return results;
}
void addOneBit (vector &num, int target, vector > &
results){
if (target =... 阅读全帖 |
|
|
|
p*****2 发帖数: 21240 | 14 写了一下。很麻烦。面试碰到肯定死了。
import java.io.*;
import java.util.*;
public class BalancedPartition
{
public static void main(String[] args)
{
new BalancedPartition().run();
}
PrintWriter out = null;
void run()
{
Scanner in = new Scanner(System.in);
out = new PrintWriter(System.out);
int[] A = new int[]
{ 1, 2, 3, 4, 5, 6 };
balancedPar(A, 7);
out.close();
}
void balancedPar(int[] A, int k)
{
int n = A.length... 阅读全帖 |
|
m*****n 发帖数: 204 | 15 package test;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import test.IElements.WaterElements;
public class H2OLockFree {
private final AtomicLong sequencer = new AtomicLong();
private final AtomicInteger contention = new AtomicInteger();
public void addO() {
addElements(WaterElements.O);
}
private void addElements(WaterElements ele) {
long id = sequencer.incrementAndGet();
contention.incrementAn... 阅读全帖 |
|
m*****n 发帖数: 204 | 16 package test;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import test.IElements.WaterElements;
public class H2OLockFree {
private final AtomicLong sequencer = new AtomicLong();
private final AtomicInteger contention = new AtomicInteger();
public void addO() {
addElements(WaterElements.O);
}
private void addElements(WaterElements ele) {
long id = sequencer.incrementAndGet();
contention.incrementAn... 阅读全帖 |
|
|
|
|
F**********s 发帖数: 1231 | 20 Laurelhurst Ele., View Ridge Ele., Bryant Ele. Wedge Ele. |
|
g********0 发帖数: 15010 | 21 Why buy such ele. dictionary? It does not worth it!!
I bought one a while ago. After I bought my smart phone for $120, I never
use my ele. dictionary again. Actually I tossed it in garbage can 3 days ago.
My smart phone has several dictionaries. I used one all time with
pronunciations. Such smart phone offer you much more, I mean much much more
functions and funs for about $100 than a ele. dictionary which I paid for $
70. All these ele. dictionary should be out of market now. |
|
a****f 发帖数: 17 | 22 1 sum([1 for ele in numberList if ele == 5])
2 [ele[i] for i,ele in enumerate(inArray)] |
|
y**o 发帖数: 8897 | 23 三个挂了的都是黑帮,搜出大量枪支,通向该区的交通一度中断,司机被告知避免路经
该地区。
Assalto a restaurante termina com três bandidos mortos na Tijuca
RIO — Três pessoas morreram no assalto ao Restaurante Brasa Gourmet, na
esquina das ruas Professor Gabizo com Mariz e Barros, na Tijuca, na manh
227; desta segunda-feira. Segundo os policiais do 4º BPM (São
Cristóvão), as vítimas são criminosos que faziam parte da
quadrilha de assaltantes.
O comandante do 4º BPM, tenente-coronel Ronald Freitas de Santana,
disse ... 阅读全帖 |
|
|
|
l*****a 发帖数: 559 | 26 写了个递归版本的。
vector code(int n){
if(n == 0){
vector codes;
codes.push_back(0);
return codes;
}
vector oneless = code(n - 1);
int len = oneless.size();
for(int i = len - 1; i >= 0; i--){
oneless.push_back(oneless[i]);
}
for(int i = 0; i < len; i++){
int ele = oneless[i+len];
ele |= 1 << (n - 1);
oneless[i+len] = ele;
}
... 阅读全帖 |
|
C****t 发帖数: 53 | 27 def revSum(a):
d = height(a)
level, sum = 1, [0]
helper(a, d, level, sum)
return sum[0]
def height(a):
d = 1
for ele in a:
if type(ele) == list:
d = max(d, 1+height(ele))
return d
def helper(a, d, level, sum):
for i in range(len(a)):
if type(a[i]) != list:
sum[0] += a[i]*(d-level+1)
else:
helper(a[i], d, level+1, sum) |
|
C****t 发帖数: 53 | 28 def revSum(a):
d = height(a)
level, sum = 1, [0]
helper(a, d, level, sum)
return sum[0]
def height(a):
d = 1
for ele in a:
if type(ele) == list:
d = max(d, 1+height(ele))
return d
def helper(a, d, level, sum):
for i in range(len(a)):
if type(a[i]) != list:
sum[0] += a[i]*(d-level+1)
else:
helper(a[i], d, level+1, sum) |
|
d**********o 发帖数: 279 | 29 没想出怎么用stack, 大牛讲解一下?
"""
Write a iterator to iterate a nested array.
For example, for given array: [1, 2, [3, [4, 5], [6, 7], 8], 9, 10]
call iterator.next() 10 times should return 1,2,3,4,5,6,7,8,9,10.
"""
def traverse(l):
if not l:
return
for i in l:
if isinstance(i, list):
traverse(i)
else:
print i
class NestIterator(object):
def __init__(self, l):
self.l = l
self.cur = -1
self.iterator = None
def next(self):
if self.iterator and s... 阅读全帖 |
|
z***n 发帖数: 590 | 30 have you compared your ele bill by doing this? you traded the propane with
ele and I think in your region, the ele may be more expensive when the heat
pump is running at low temp. |
|
l***i 发帖数: 64 | 31 The Neuromuscular Rehabilitation Engineering Laboratory at the University of
Rhode Island is seeking applicants for graduate research assistants for
Fall 2013. We encourage highly motivated students in Biomedical, Electrical,
or Computer Engineering to apply and participate in our exciting research
projects. The students who have relevant research/industrial experiences
are preferred.
A link about the positions:
http://www.ele.uri.edu/faculty/huang/index_files/positions.htm
More info can be fou... 阅读全帖 |
|
|
|
l****u 发帖数: 32 | 34 有意者请联系:Email: [email protected]/* */
1. Netgear N450 WiFi DOCSIS 3.0 Cable Modem Router - $70
- Two-in-One DOCSIS 3.0 Cable Modem + WiFi Router delivers N450 WiFi
- Up to 340Mbps modem speed, 8 times faster than DOCSIS 2.0
- Eliminate monthly cable modem rental fees
- Compatible with U.S. Cable Internet Providers (ISPs) like Cablevision,
Charter, Cox, Time Warner Cable, XFINITY and more
- Four Gigabit Ethernet Ports for fast wired connections and two USB
ports to wirelessly ... 阅读全帖 |
|
r*********2 发帖数: 88 | 35 【 以下文字转载自 FleaMarket 讨论区 】
发信人: raphael2002 (持酱油瓶围观), 信区: FleaMarket
标 题: 【出售】准备海归了,出:40'' philip TV/ Xbox360/ 21.5'' HP monito
发信站: BBS 未名空间站 (Sun Jan 25 16:24:27 2015, 美东)
准备海归了,想出一些东西,我们人在NYC LongIslandCity靠近queens sunnyside这里
,下面的东西想看可以在周一到周五晚上或者周末来看。
1. Xbox 360 Console-250GB + Kinect Bundle - $160
几乎都没怎么玩过,估计不超过10次,还有两个挺傻的游戏,状况几乎是全新的。
http://newyork.craigslist.org/que/ele/4851512353.html
2. Philips LCD TV 40PFL3706 40" Full HD 1080p digital TV with Pixel HD - $
250
当时在TARGET买来将近500吧好像,也是... 阅读全帖 |
|
r*********2 发帖数: 88 | 36 【 以下文字转载自 FleaMarket 讨论区 】
发信人: raphael2002 (持酱油瓶围观), 信区: FleaMarket
标 题: 【出售】准备海归了,出:40'' philip TV/ Xbox360/ 21.5'' HP monito
发信站: BBS 未名空间站 (Sun Jan 25 16:24:27 2015, 美东)
准备海归了,想出一些东西,我们人在NYC LongIslandCity靠近queens sunnyside这里
,下面的东西想看可以在周一到周五晚上或者周末来看。
1. Xbox 360 Console-250GB + Kinect Bundle - $160
几乎都没怎么玩过,估计不超过10次,还有两个挺傻的游戏,状况几乎是全新的。
http://newyork.craigslist.org/que/ele/4851512353.html
2. Philips LCD TV 40PFL3706 40" Full HD 1080p digital TV with Pixel HD - $
250
当时在TARGET买来将近500吧好像,也是... 阅读全帖 |
|
w*******e 发帖数: 2651 | 37 Leg 5
Time: 6/17 02:07:27 PM
Duration: 01:07:13
Mileage: 7.4
Avg pace: 9:05
Ele. gain: 1210 ft
Net roadkills: 16
Leg 17
Time: 6/17 10:00:33 PM
Duration: 00:33:00
Mileage: 4.2
Avg pace: 7:51
Ele. gain: 127 ft
Net roadkills: 6
Leg 29
Time: 6/18 08:25:20 AM
Duration: 00:25:28
Mileage: 3.33
Avg pace: 7:38
Ele. gain: 190 ft
Net roadkills: 15
I ate a lot of dust while running leg 5 on the country road.
The view ... 阅读全帖 |
|
q****a 发帖数: 21 | 38 快意之事莫若友,快友之事莫若谈。其孰曰不然?然亦何曾多得。春夏之交,青黄不接
,说话儿的功夫就将步入金秋九月。朝日初出,苍苍凉凉,微风掀拂塘间绿波和塘边的
绿草,送给人一种经久不磨的印象;洗头面,裹巾帻,饮汤食,诸事甫毕,遂操提刀笔。
“911事件”早已家喻户晓、妇孺皆知。哪里有阴谋论,哪里就有出来辟谣的;假作真
时真亦假,真作假时假亦真,大众真假不分。时至今日,还有许多相信世贸大楼真是拉
登干的,并且平拍手称快,可见这个谣言误人之深、流传之广。这个事件有什么背景?
事件的本质是什么?“9-11”这组数字对我们当下在地球上的生活和生存又有什么非常
的警示?要突破僵局就要另辟蹊径,我们不打别人的牌,更不让人拿我们当牌打。敢于
走前人没有走过的路,坚决地试,大胆地闯,革新学术,砥砺品行,改良人心风俗。我
们现在讨论的各项话题,这是一个新的事业,马克思没有讲过,我们的先人没有做过,
没有现成的经验可学,只能在干中学,在实践中探索,疏导利用,消除误解。下面开始
进入正文。
2000年9月,美国国防部发布的《重建美国国防报告》中有这样一段意味深长的话:“
变革的过程可能会非常漫长,除非出现一个灾... 阅读全帖 |
|
l***i 发帖数: 64 | 39 The Neuromuscular Rehabilitation Engineering Laboratory at the University of
Rhode Island is seeking applicants for graduate research assistants for
Fall 2013. We encourage highly motivated students in Biomedical, Electrical,
or Computer Engineering to apply and participate in our exciting research
projects. The students who have relevant research/industrial experiences
are preferred.
A link about the positions:
http://www.ele.uri.edu/faculty/huang/index_files/positions.htm
More info can be fou... 阅读全帖 |
|
h*******i 发帖数: 4386 | 40 米兔杀伤力越来越大,哈哈。Verdu同志其实就是想占韩国妹纸一点便宜,摸摸大腿,
捏捏胸部,没想到韩国妹纸根本不吃这一套,直接向校党委纪律委员会汇报了,老同志
没想到吃窝边草真栽了。
Verdu悲愤之下,向我党交了千人申请,要加入华为中研,做OFDM之父童文博士的副手
,天天四处宣讲香浓图灵,以米国科学和工程两院院士身份,在中国还是很吃得开的,
我党就尿这一壶。OS9要混得好,还是得海龟,勿论东西。
On Friday night, Assistant Vice President for Communications Dan Day
confirmed that professor Sergio Verdú was dismissed from the faculty as of
Sept. 24 following a University investigation into his conduct in relation
to University policies that prohibit consensual relations with students and
req... 阅读全帖 |
|
h*******i 发帖数: 4386 | 41 米兔杀伤力越来越大,哈哈。Verdu同志其实就是想占韩国妹纸一点便宜,摸摸大腿,
捏捏胸部,没想到韩国妹纸根本不吃这一套,直接向校党委纪律委员会汇报了,老同志
没想到吃窝边草真栽了。
Verdu悲愤之下,向我党交了千人申请,要加入华为中研,做OFDM之父童文博士的副手
,天天四处宣讲香浓图灵,以米国科学和工程两院院士身份,在中国还是很吃得开的,
我党就尿这一壶。OS9要混得好,还是得海龟,勿论东西。
On Friday night, Assistant Vice President for Communications Dan Day
confirmed that professor Sergio Verdú was dismissed from the faculty as of
Sept. 24 following a University investigation into his conduct in relation
to University policies that prohibit consensual relations with students and
req... 阅读全帖 |
|
|
|
|
|
|
|
|
|