|
|
|
w*******y 发帖数: 60932 | 4 It's cheap. I bought one. I like it it and found some good reviews, but move
on if you want a heavy, full featured model. It might last a couple years.
Hey, some grill covers cost this much! Probably tax too. I didn't want an
outdoor tabletop or I would have bought the Costco $99.99 stainless steel
model. to Ben's.
Sears has the Char-Broil 2 Burner Gas Grill (463612010) for $70 $5 off with
coupon code SEARS2011 = $64 Two stainless steel burners with 26,500 BTU
output, 280 square inches of cook... 阅读全帖 |
|
w*******y 发帖数: 60932 | 5 Homedepot has a Char-broil 2 Burner Gas grill for $59. Not bad for a
starter or cheap upgrade from charcoal for Father's Day. I lover my
charcoal but def miss having a small gas for grilling in the winter right
outside my garage door.
|
|
w*******y 发帖数: 60932 | 6 I was visiting NorCal wine country and I saw this Char Broil Stainless Steel
Infrared Gas Grill for $149.97 at Costco (Santa Rosa / Rohnert Park).
Obviously it's YMMV. They had 3 of them left yesterday. Usually things
that end ".97" at Costco are clearance items. There were some other summer
clearance items spread around the aisles as well.
Features:
-Infrared Gas Grill
-Halogen Lights Included
-21,000 BTU
-Stainless Steel
-Cover Included
-340sq in. Cooking Surface
Item Number:
463262911
It ... 阅读全帖 |
|
w*******y 发帖数: 60932 | 7 Home Depot has the Char-Broil Big Easy Oil-Less Fryer Model # 10101480 for
for $69.00 less $5.00 coupon code (HDCYBER2) thru 12/12/2011 for the coupon
code (minimum$50.00 order) with free shipping. Home Depot has a fair amount
of stock at stores near me.
Link = Link:
http://www.homedepot.com/h_d1/N-5yc1v/R-100655049/h_d2/ProductD ALL&jspStoreDir=hdus&catalogId=10053&navFlow=3&keyword=100655049&Ntpc=1&langId=-1&Nu=P_PARENT_ID&storeId=10051&Ntpr=1&ddkey=Search#BVRRWidgetID
#BVRRWidgetID" rel="nof... 阅读全帖 |
|
g******y 发帖数: 2517 | 8 Char-Broil Quantum Infrared Urban Gas Grill with Folding Side Shelves, 42%
Off
http://amzn.to/yjRWiN |
|
d**********o 发帖数: 1321 | 9 最终版本的compiler测试结果
=================================================
Output of Building User Code
Explode the tar
c-.l
c-.y
scanType.h
makefile
symtab.h
symtab.cpp
emitCode.h
emitCode.cpp
20131214164956-huang-CS445-F13-A5.tar: POSIX tar archive (GNU)
Tests: directory
c-.l: lex description text
c-.y: lex description text
emitCode.cpp: ASCII C++ program text
emitCode.h: ... 阅读全帖 |
|
d**********o 发帖数: 1321 | 10 最终版本的compiler测试结果
=================================================
Output of Building User Code
Explode the tar
c-.l
c-.y
scanType.h
makefile
symtab.h
symtab.cpp
emitCode.h
emitCode.cpp
20131214164956-huang-CS445-F13-A5.tar: POSIX tar archive (GNU)
Tests: directory
c-.l: lex description text
c-.y: lex description text
emitCode.cpp: ASCII C++ program text
emitCode.h: ... 阅读全帖 |
|
d**********o 发帖数: 1321 | 11 hw3 & hw3b 最终结果
贴一个自己 hw3b 的 match 结果让小伙伴们感受一下我们作业需要的结果是什么样子
的。
如果是同专业的小伙伴,最后拷贝到编辑器中仔细看一下,这个网页因为宽度有限,让
并排两列的比较呈现出来的很变形。
=================================================
Output of Building User Code
Explode the tar
c-.l
c-.y
makefile
scanType.h
symtab.h
symtab.c
20131116163236-(me~~)-CS445-F13-A3B.tar: POSIX tar archive (GNU)
Tests: directory
c-.l: lex description text
c-.y: lex description text
... 阅读全帖 |
|
d**********o 发帖数: 1321 | 12 hw3b deadline前版本
这里我也先公开承认一下自己早前犯过的错误,在这个楼的第 14 页、第 265 楼,我
有贴出自己的hw3b,但现在我必须向亲爱的读者一一您公开道歉。因为当时因为着急,
我没能找到hw3b deadline前的版本,就把这次作业后来的最终版本(也就是那个楼贴
出来的,只剩下ReturnK、CompoundK两条小尾巴的版本,那个版本被我改动了时间戳我
现在已经把它改回来了。相比于急于求成绩,我更希望自己作一个诚实的人,希望大家
能原谅)给贴出来了。因为我们作业deadline之后也还都是可以接着交的,所以任何作
业,老师都是可以根据后来的版本,追终到这个学生的最后进展的,这个最新进展老师
到底给不给分、就要看老师如何下决定了。
deadline前的版本,被我附在下面了。
当然,把自己的这个版本更新后,我愿为这个楼(这一次出来写的所有)属于自己的每
个贴子负责,所有写出来的,都是真实发生过的事。
=================================================
Output of Building User Code
Ex... 阅读全帖 |
|
d**********o 发帖数: 1321 | 13 hw3 & hw3b 最终结果
贴一个自己 hw3b 的 match 结果让小伙伴们感受一下我们作业需要的结果是什么样子
的。
如果是同专业的小伙伴,最后拷贝到编辑器中仔细看一下,这个网页因为宽度有限,让
并排两列的比较呈现出来的很变形。
=================================================
Output of Building User Code
Explode the tar
c-.l
c-.y
makefile
scanType.h
symtab.h
symtab.c
20131123233236-(me~~)-CS445-F13-A3B.tar: POSIX tar archive (GNU)
Tests: directory
c-.l: lex description text
c-.y: lex description text
... 阅读全帖 |
|
d**********o 发帖数: 1321 | 14 hw3b deadline前版本
这里我也先公开承认一下自己早前犯过的错误,在这个楼的第 14 页、第 265 楼,我
有贴出自己的hw3b,但现在我必须向亲爱的读者一一您公开道歉。因为当时因为着急,
我没能找到hw3b deadline前的版本,就把这次作业后来的最终版本(也就是那个楼贴
出来的,只剩下ReturnK、CompoundK两条小尾巴的版本,那个版本被我改动了时间戳我
现在已经把它改回来了。相比于急于求成绩,我更希望自己作一个诚实的人,希望大家
能原谅)给贴出来了。因为我们作业deadline之后也还都是可以接着交的,所以任何作
业,老师都是可以根据后来的版本,追终到这个学生的最后进展的,这个最新进展老师
到底给不给分、就要看老师如何下决定了。
deadline前的版本,被我附在下面了。
当然,把自己的这个版本更新后,我愿为这个楼(这一次出来写的所有)属于自己的每
个贴子负责,所有写出来的,都是真实发生过的事。
=================================================
Output of Building User Code
Ex... 阅读全帖 |
|
S**I 发帖数: 15689 | 15 ☆─────────────────────────────────────☆
recursive (递归) 于 (Mon Apr 11 10:56:49 2011, 美东) 提到:
大半夜收到HR的thank you note。不用管什么NDA了
本人ECE fresh PhD,背景是电路/EDA,跟G业务基本没什么关系
同学内部推荐的,很简单的一次电面就给了onsite
题都不难,但是自己没把握好机会,出了一些小bug。
总的感觉,出错就是硬伤,宁可从最简单的算法写起,也不能出错。
电面:
1,Skip list, http://en.wikipedia.org/wiki/Skip_list
写code实现struct skip_list * find(struct skip_list *head, int value)
2,sorted array with repeated elements
for given element, find out its range.
e.g. A A B B B B B C C D D E F G, given B, the out... 阅读全帖 |
|
d**********o 发帖数: 1321 | 16 hw3b c-.y file
上面这一楼贴了载止hw3b deadline时我match的结果(也就是老师可以以这些不match
的ERROR为借口不给后来我补上的成绩),但是因为当时我还是没有写完,后来感恩节
期间就接着又写了一些,而且hw5是based on hw3 & hw3b的基础上(当我hw5是based
on更好的hw3的结果时,我应该可以得更多的分吧)。
hw4因为写得比较顺利,就不曾保留任何交上去作业的output,没有什么一目了然的结
果是我可以贴在这里的。原本我是想要把自己最的一次作业hw5贴出来的,但那已经是
一个完整的compiler,而且以后我还需要用自己的course project来找工作,所以一定
就不贴最终结果了。那就贴一个hw3b的c-.y文件吧,它集中的hw1、hw2、hw3、 hw3b的
结果,是我自己hw3b *.y文件的最完整版本。这些作业里面也有很多机关一一人为增加
的难度,比如那六七个IO相关的function,不仅traverse tree、build syntax tree的
时候会成为一个考点(把它们作为一个node连在syntax... 阅读全帖 |
|
d**********o 发帖数: 1321 | 17 hw3b c-.y file
上面这一楼贴了载止hw3b deadline时我match的结果(也就是老师可以以这些不match
的ERROR为借口不给后来我补上的成绩),但是因为当时我还是没有写完,后来感恩节
期间就接着又写了一些,而且hw5是based on hw3 & hw3b的基础上(当我hw5是based
on更好的hw3的结果时,我应该可以得更多的分吧)。
hw4因为写得比较顺利,就不曾保留任何交上去作业的output,没有什么一目了然的结
果是我可以贴在这里的。原本我是想要把自己最的一次作业hw5贴出来的,但那已经是
一个完整的compiler,而且以后我还需要用自己的course project来找工作,所以一定
就不贴最终结果了。那就贴一个hw3b的c-.y文件吧,它集中的hw1、hw2、hw3、 hw3b的
结果,是我自己hw3b *.y文件的最完整版本。这些作业里面也有很多机关一一人为增加
的难度,比如那六七个IO相关的function,不仅traverse tree、build syntax tree的
时候会成为一个考点(把它们作为一个node连在syntax... 阅读全帖 |
|
a******e 发帖数: 36306 | 18 Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0;
chromeframe/11.0.696.57; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0
.4506.2152; .NET CLR 3.5.30729; OfficeLiveConnector.1.3; OfficeLivePatch.0.0)
Timestamp: Sun, 8 Apr 2012 18:46:19 UTC
Message: Object doesn't support this property or method
Line: 20
Char: 78
Code: 0
URI: https://s-static.ak.fbcdn.net/rsrc.php/v1/yH/r/dLyZ2TBtIHU.js
Message: Object doesn't support this property or method
Li... 阅读全帖 |
|
z****u 发帖数: 104 | 19 字符串的 permutation 肯定是比较基础的题了,可是自己写了一下发现要 bug free
真心很难啊。调试了半天才 ok,而且程序看起来很臃肿,这要是在白板上铁定写不出
来啊
求大家指点一下该向哪个方向改进?
#include
#include
#include
char* insert(char* dst, int n, char c, int j)
{
/* Insert char c into string dst at location j */
n++;
dst = (char*) realloc(dst, sizeof(char) * n);
while(j < n)
{
char tmp = dst[j];
dst[j] = c;
c = tmp;
j++;
}
return dst;
}
char** permutation_recursive(char* s, int n, in... 阅读全帖 |
|
f**********t 发帖数: 1001 | 20 // Given an string array sorted by characters in another string.
// Return that sorting base string.
// Example. give you
// {foo, cat, cao, bag, bat, aac}
// return: fcbagto
void buildGraph(vector &vs, unsigned col, unsigned up, unsigned down,
map> &res) {
char pre = '#';
unsigned count = 0;
unsigned uu = up;
for (unsigned i = up; i < down; ++i) {
if (vs[i].size() <= col) {
break;
}
if (vs[i][col] == pre) {
++count;
} else {
... 阅读全帖 |
|
x******a 发帖数: 6336 | 21 I got thousands problems on the following piece of code "dumpfile.h" when I
compile under cygwin. it is ok under visual stduio... can anyone help?
Thanks!
#include
#include
#include //ostream_iterator
#include //cerr
#include //std::copy
template
void dump_to_file(const char* filename, const std::vector& v_d){
std::ofstream ofs(filename);
if(!ofs){
std::cerr<<"Unable to open the file to write!n";
return ;... 阅读全帖 |
|
e********r 发帖数: 2352 | 22 在本地的考试中心预约的上机考试。考试有三个部分,1.数学题,2.给出一种新的编程
语言的语法,回答相应问题,3. Programming Test 要求速度和准确性both important
Programming test 答得不好,肯定不行了,把面试题发上来让大家做做。做了3个半小
时,快累死了。
数学题基本上就是脑筋急转弯,举几个例子
1. You have three kinds of magazines, all but two are Times, all but two are
Science, all but two are Nature. How many magazines in total do you have?
3 books
2. Only one of the answers is true
A. All of the below are true
B. All answers are true
C. One of the above is true
D. All of the above are true
E. None of the above ar... 阅读全帖 |
|
O*******d 发帖数: 20343 | 23 两幅图像在切换时,我用了颜色混合。 Windows的GDI没有比较好的混合颜色的方法。
我写这个屏保时不打算用OpenGL来做。于是自己写了一个混合颜色的class。 主要想法
是用空间换时间,。颜色混合用查表法。 两个颜色,不管红绿蓝,就是一个2维数组的
index,那个位置的颜色就是事先计算好的混合色。
#include
class ColorBlender
{
public:
ColorBlender(double alpha) { mAlpha = alpha;mLookupTable = NULL;
CreateTable(); }
~ColorBlender() {delete [] mLookupTable ;}
unsigned char Blend(unsigned char firstColor, unsigned char
secondColor);
void Blend(const unsigned char * pFirstColor, const unsi... 阅读全帖 |
|
p*********b 发帖数: 47 | 24 9,Unix file path化简,写code
例如 /a/./b/../../c/ ,化简为 /c/
用stack或者d-queue,有些细节需要考虑,例如 /..//.. 还是输出 /
这题不需要额外的数据结构,从尾部向前反过来做。
我之前写的代码
/* The algorithm runs in O(n) time and O(n) space
* It works backwards so that no stack or other buffer is
* needed to skip the parents folder if a "../" is encountered.
* "//" is preserved as is, and "/./" is changed to "/
* I was able to do a inplace version, but string cut and cat are
* essentially array element revomal, which will make running time
* O(n^2).
*
* My ... 阅读全帖 |
|
c********s 发帖数: 817 | 25 This is my implementation for these two functions, and a driver to run them.
cat string_reverse.c
#include
#include
#include
void swap(char* c1, char* c2);
// -----------------
void string_reverse1(char* string) {
if (string == NULL)
return;
char* head = string;
char* tail = head;
// find the tail
while (*tail) ++tail;
--tail;
// while loop to do the swap
while (head < tail)
swap(head++, tail--);
}
// -----------------
// the caller of this function is res... 阅读全帖 |
|
l********a 发帖数: 1154 | 26 来自主题: Programming版 - map析构
跟踪了2天才找到这个问题,难道dll内自定义的类不能使用stl容器吗?
像我这种定义的容器数据非指针,该怎么释放呢?
没有其他解决办法吗?我这个map没有跨dll传递啊?
在testGA类定义里面声明,
构造函数里面map.insert(make_pair())添加内容,使用完后立即clear(),
在析构函数内没有操作map,因为已经被clear()了,又不是指针,无法delete
下断后出错在~testGA的时候会调用~map,
testGA.dll!std::map,std::
allocator >,double,std::less
char>,std::allocator > >,std::allocator
char,std::char_traits,std::allocator > const ... 阅读全帖 |
|
c***2 发帖数: 838 | 27 Here's the full file. You may compile and run: any case I missed?
==================================================================
/* wild.c
*/
#include
#include
#include
#define STR_SIZE 256
//===========================================================
int matchndots(const char *text, const char *dstr, int len)
{
while(len&&*text&&*dstr&&(*text==*dstr || *dstr=='.')){
text++;
dstr++;
len--;
}
if(!len)
return 1;
... 阅读全帖 |
|
z******e 发帖数: 82 | 28 借用eswine的idea:
public static String test1(String str) {
StringBuilder sb = new StringBuilder();
int len = str.length();
boolean escape = false;
for (int i = 0; i < len; i++) {
char c = str.charAt(i);
// everything between ' '
if (c == '\'') {
escape = true;
while (i < len) {
c = str.charAt(i);
sb.append(c);
if (c == '\'' && !escape) {... 阅读全帖 |
|
g*****i 发帖数: 2162 | 29 可能我说的不清楚,用个图解一下.
如果char[i]!=char[i-1] &&char[i]!=char[i-2],push to "newest stack" 一开始也
就是stack0
如果char[i]=char[i-1]的的时候,偶数palindrome,new queue1, new stack1, char[i]
进去stack1,stack0.pop()进入queue1.
如果char[i]=char[i-2],奇数palindrome,char[i-1],char[i-2]都要从stack0 pop出来
进去queue1, char[i]还是进入stack1
如果stack0空了,是个solution.
在这过程中任何时候stack0+queue1+stack1都可以看成一个整体的stack
一旦又出现char[i]!=char[i-1] &&char[i]!=char[i-2],那么newest stack变成stack1
,循环下去.以后发现可能的palindrome时候要从新到旧把前面的stack和queue都清空才
是solution. |
|
S**I 发帖数: 15689 | 30 N久以前写的一个:
#include
int getDecimal(char);
int romanToDecimal(char *);
char getRoman(int);
char * digitToRoman(int, int, char *);
char * decimalToRoman(int, char *);
int main(int argc, char* argv[]){
printf("Roman: %s\n", argv[1]);
int d = romanToDecimal(argv[1]);
printf("Decimal: %d\n", d);
char r[1000];
decimalToRoman(d, r);
printf("Roman: %s\n", r);
}
int getDecimal(char a){
switch(a){
case 'I':
return 1;
case 'V':
return 5;
... 阅读全帖 |
|
k**********i 发帖数: 36 | 31 ►►►Regular Expression Matching
Implement regular expression matching with support for '.' and '*'.
'.' Matches any single character.
'*' Matches zero or more of the preceding element.
The matching should cover the entire input string (not partial).
The function prototype should be:
bool isMatch(const char *s, const char *p)
Some examples:
isMatch("aa","a") → false
isMatch("aa","aa") → true
isMatch("aaa","aa") → false
isMatch("aa", "a*") → true
isMatch("aa", ".*") → true
isMatch... 阅读全帖 |
|
d****n 发帖数: 1637 | 32 my shabby code for questions 4.
//File resovle.c
#include
#include
#include
#define MAXLINECHARSIZE 1000
inline int fsplit(char *line, char **items, char delim);
int main(int argc, char * argv[]){
/***prepare && allocate buffer/space***/
int n,nbytes=100, maxcol=10, maxchar=1000;
char **items;
{
items=(char **) malloc(maxcol*sizeof(char *));
int i;
for(i=0; i
items[i]=(char*)malloc(maxchar*sizeo... 阅读全帖 |
|
s*****y 发帖数: 897 | 33 根据题目和next_permutation 的实现,写了个相应的,assume input string is
sorted
inline void swap(char *i, char *j) {
char tmp = *i;
*i = *j;
*j = tmp;
}
inline void reverse(char *start, char *end){
while (start < end) {
swap(start, end);
start ++;
end--;
}
}
bool perm_loop(char *str, char *start, char *end) {
char *i = end-1;
//find first two pairs from the end that *i < *(i+1)
while((i >= start) &&(*i >= *(i+1))) i--;
//could not find such pair
if... 阅读全帖 |
|
s*****y 发帖数: 897 | 34 根据题目和next_permutation 的实现,写了个相应的,assume input string is
sorted
inline void swap(char *i, char *j) {
char tmp = *i;
*i = *j;
*j = tmp;
}
inline void reverse(char *start, char *end){
while (start < end) {
swap(start, end);
start ++;
end--;
}
}
bool perm_loop(char *str, char *start, char *end) {
char *i = end-1;
//find first two pairs from the end that *i < *(i+1)
while((i >= start) &&(*i >= *(i+1))) i--;
//could not find such pair
if... 阅读全帖 |
|
s*******f 发帖数: 1114 | 35 //码遍本版
//i cannot get this should-be-right version within 15 minutes
//use reversed storage. say 1345 store as "5431"
char* MultiplyString(char *a,char *b){
if (!a || !b)
return NULL;
int la = strlen(a);
int lb = strlen(b);
int lc = la + lb + 1;
char *ret = new char[lc];
char *r = ret;
memset(ret, '\0', lc);
while (*a){
char *p = b;
char *q = r++;
int inc = 0;
int mul = *a - '0';
while (*p){
int qq = *q?... 阅读全帖 |
|
S**I 发帖数: 15689 | 36 楼上的全是Java,俺来一个C的吧(各种exception懒得写了):
#include
int getDecimal(char);
int romanToDecimal(char *);
char getRoman(int);
char * decimalToRoman(int, char *);
int main(int argc, char* argv[]){
printf("Roman: %s\n", argv[1]);
int d = romanToDecimal(argv[1]);
printf("Decimal: %d\n", d);
char r[1000];
decimalToRoman(d, r);
printf("Roman: %s\n", r);
}
int getDecimal(char a){
switch(a){
case 'I':
return 1;
case 'V':
return 5;
case 'X':... 阅读全帖 |
|
f******5 发帖数: 11 | 37 Thanks so much.
The compiler I am using is Dev c++ 4.9.9.2
Can I use New operator inside LCS like follows? It shows more compiling time
error?
Or should I declare c[][] outside the helping function LCS or inside Main()
function?
I want to pass the arrayc[][] and b[][] at the end of LCS to another Helping
function called
Print_LCS.
From your point of view, where should I declare the c[][] and b[][]
If i use New operator as follows to declare and initialize c[][], c[][],
both c[][] and b[][] go ou... 阅读全帖 |
|
c**s 发帖数: 43 | 38 你解释的和上面storm说的是一样的。
关于paul的链表,我没看仔细,下面是我自己写的。
没想到要写这么久。真的面的时候应该就废了。
很长,有耐心就慢慢看吧。。不知道对了对,意思应该在那了。
早知道应该写成C,可以跑试试看。
这么长,只是为了比begin-end那个少扫一遍。。。
defrecord NodeType
ch char
pos int
prePos *NodeType
nxtPos *NodeType
preSameChar *NodeType
nxtSameChar *NodeType
// S2 char to first tracked S2 NodeType (pointing to the start of
// a linked list of same char NodeType by nxtSameChar)
nodesFoundFirst hashmap
// S2 char to last tracked S2 NodeType (pointing to the end of
// a linked list of ... 阅读全帖 |
|
j***y 发帖数: 2074 | 39 在193~194页,书里谈到了一个下面的问题:
---
Signedness of char. In C and C++, it is not specified whether the char data type is signed or unsigned. This can lead to trouble when combining chars and ints, such as in code that calls the int-valued routine getchar(). If you say
? char c; /* should be int */
? c = getchar();
the value of c will be between 0 and 255 if char is unsigned, and between -128 and 127 if char is signed, for the almost universal configuration of 8-bit characters on a two's complement machin... 阅读全帖 |
|
l*********8 发帖数: 4642 | 40 I modified the program.
Now the major function should be simple enough (although the whole
program is not that short).
class Solution {
public:
bool isMatch(const char *s, const char *p) {
if(!s || !p )
return false;
const char * nextStar = strchr(p, '*');
if ( !nextStar)
return strCmp(s, p);
if (!strCmpN(s, p, nextStar-p) )
return false;
do {
s += nextStar-p;
p = nextStar + 1;
n... 阅读全帖 |
|
e****e 发帖数: 418 | 41 public class LineReader {
private int pos = 0;
private List chars = null;
public Character[] readLine() {
if ( chars == null || chars.size() == 0 )
chars = Arrays.asList( read4096() );
List line = new ArrayList();
int i = pos;
while ( i < chars.size() && chars.get(i) != '\n' && chars.get(i) !=
'\0' )
line.add( chars.get(i++) );
if ( chars.get(i) == '\n' ) {
... 阅读全帖 |
|
J**9 发帖数: 835 | 42 Problem at
http://discuss.leetcode.com/questions/765/word-break
This does not seem to be a DP problem, just do it in a straightforward way.
Here's my implementation in C. Any issue?
Thanks.
//===========================================================
#include
#include
#include
#include
#include
/**
* Given a string s and a dictionary of words dict, determine if s can be
segmented into a space-separated sequence of one or more
* dictionary w... 阅读全帖 |
|
f**********t 发帖数: 1001 | 43 来自主题: JobHunting版 - 面试题讨论 #include "common.h"
void CS_(const vector &vs, size_t up, size_t down, size_t col,
map> &graph) {
size_t uu = up;
while (uu < down && vs[uu].size() <= col) {
++uu;
}
if (uu + 1 >= down) {
return;
}
char pre = vs[uu][col];
for (size_t dd = uu + 1; dd < down; ++dd) {
if (vs[dd].size() <= col) {
continue;
}
if (pre != vs[dd][col]) {
graph[pre].insert(vs[dd][col]);
if (uu + 1 < dd) {
CS_(vs, uu, dd... 阅读全帖 |
|
|
n********y 发帖数: 66 | 45 欢迎拍砖,就用了一个 256 字节的table来检查一个数字是否出现过
#include
#include
#include
#include
char* nextpointer(char* str, int strlen)
{
char *p = str;
char *pend = str + strlen;
char count[256];
memset(count, 0, sizeof(count));
while (p < pend)
{
++count[*p];
if (count[*p] > 1)
{
return p;
}
++p;
}
return p;
}
void longestsingle(char* str, int strlen)
{
char *pstart = str;
char *pend... 阅读全帖 |
|
S**I 发帖数: 15689 | 46 ☆─────────────────────────────────────☆
gzou (gzou) 于 (Thu May 12 02:26:35 2011, 美东) 提到:
马上就要G on site了,
求祝福。
下面是从本版收集到的Google的试题,便于大家查询。
申明:有的附带有解释说明的,也来自于本版或者网络,大家自己看, 不保证真确
http://www.mitbbs.com/article_t1/JobHunting/31847453_0_1.html
本人ECE fresh PhD,背景是电路/EDA,跟G业务基本没什么关系
同学内部推荐的,很简单的一次电面就给了onsite
题都不难,但是自己没把握好机会,出了一些小bug。
总的感觉,出错就是硬伤,宁可从最简单的算法写起,也不能出错。
电面:
1,Skip list, http://en.wikipedia.org/wiki/Skip_list
写code实现struct skip_list * find(struct skip_list *head, int value)
2,sorted array... 阅读全帖 |
|
S**I 发帖数: 15689 | 47 ☆─────────────────────────────────────☆
gzou (gzou) 于 (Thu May 12 02:26:35 2011, 美东) 提到:
马上就要G on site了,
求祝福。
下面是从本版收集到的Google的试题,便于大家查询。
申明:有的附带有解释说明的,也来自于本版或者网络,大家自己看, 不保证真确
http://www.mitbbs.com/article_t1/JobHunting/31847453_0_1.html
本人ECE fresh PhD,背景是电路/EDA,跟G业务基本没什么关系
同学内部推荐的,很简单的一次电面就给了onsite
题都不难,但是自己没把握好机会,出了一些小bug。
总的感觉,出错就是硬伤,宁可从最简单的算法写起,也不能出错。
电面:
1,Skip list, http://en.wikipedia.org/wiki/Skip_list
写code实现struct skip_list * find(struct skip_list *head, int value)
2,sorted array... 阅读全帖 |
|
s*******f 发帖数: 1114 | 48 //回报本版,码遍本版
//Given a string of sorted integers, e.g. "1 52 69 456789 994546566";
//and a a number e.g. 69.
//You need to tell if it is in the input, e.g. 69=>true.
//strlen is O(n), don't use C style string for O(log n), suppose
//the string is friendly without lots of blank.
void GetWordPos(const char *mid, const char *left, const char *right, const
char **pstart, const char **pend){
while (isspace(*mid))
++mid;
*pstart = mid;
while (*pstart >= left && !isspace(**pstart))
... 阅读全帖 |
|
z******e 发帖数: 82 | 49 -_-!!, what bad test skill I have.
for this test case, change
if (c == '"' && !slash2 && !slashstar) {
to
if (c == '"' && lastc != '\' && !slash2 && !slashstar) {
complete code:
private static String uncomment(String str) {
boolean slash2 = false;
boolean inStr = false;
boolean slashstar = false;
StringBuilder sb = new StringBuilder();
char lastc = ' ';
char c = ' ';
int deleteStart = -1;
for (int i = 0; i < str.length(); i++) {
... 阅读全帖 |
|
r********g 发帖数: 14 | 50
string 遍历一遍即可
伪码:
for each char in string str
if char in hashtable
change the value of key char in hashtable( key char value 2)
next char
else
linkedlist.tail->next.value= char
tail = tail->next;
add char to hashtable( key char value 1)
end of loop for string // just one time
//now let us deal with the linkedlist
while( header != null){
if header value in hashtable is 2 ( hashtable.get(header)==2) // header is
duplicate
header = header->next;
else return header->value // first non-duplicate ch... 阅读全帖 |
|