Complete code:
import java.util.*;
import java.lang.Math.*;
// Customized Tree for sorting ending times and count how many ending times
are earlier than inserted one to compute the racer's score.
// Insertion is O(nlgn)
class node{
int val;
int below;
node left;
node right;
node(int val){this.val = val; left = right = null; below = 0;}
}
class Tree{
node root;
Tree(){root = null;}
int insert(int val){
node N = root;
if(N == null){
root ... 阅读全帖
结果:面试7家,5 onsite,3 offer。
面经:
Amazon:2轮电面,5轮onsite。2天后offer,最后decline,非常nice的manager(拿到
A offer时还在面其它公司,比较大度地祝我good luck),拒绝的时候感情上比较难受。
电面1,设计parking lot
2, intersection of sorted int array; design data structure for a phone
contact book
onsite 1: find biggest int in array,
find K biggest int in array(tradeoff between many methods),
implement using heap
2: print modification path from "head" to "tail", given isWord()
api and every time can modify 1 word in the strin... 阅读全帖
攒了个段子请大牛点评一下:
// Not thread-safe
// Talk about validation requirement: none vs in next() vs in constructor
private static class DeepIterator implements Iterator {
private final Iterator
攒了个段子请大牛点评一下:
// Not thread-safe
// Talk about validation requirement: none vs in next() vs in constructor
private static class DeepIterator implements Iterator {
private final Iterator myIterator;
private final Class eleType;
private final Iterator empty = new ArrayList().iterator();
Then I recommend you to start with TopCoder. Don't
need to try Division 2 level 3. By the time you can
fluently deal with muti-level loops, complex boolean
statements, helper functions, and common data structures,
you can start with Leetcode. Make sure you can code
simple algorithms fluently. There are quite some real
interview questions that don't require complex algorithms
but purposely make it hard to handle parameters, loops,
and recursions,etc. You may notice TopCoder uses int array
a lot, ... 阅读全帖
我的想法, 极其简单, I could not find anything wrong, I found most of the
solutions are difficult to write and easy to make mistakes.
you can finish the following in less than 5 minutes and most importantly
hard to make mistakes.
bool isValide(char *string)
{
char *p = string;
if (p == NULL) return false;
p += skipWhiteSpaces(p);
p += skipSigns(p);
int n1 = skipDigits(p);
p+= n1;
if (*p == '.') p++;
int n2 = skipDigits(p);
if (n1 == 0 && n2 == 0) return false;
Since never know which value will help to get the maxValue for each helper's
return, a value list should be saved.
Then, one loop to check each operator. Two loops to check every possible
pair of sub-parts?
1. Given a method (public int Rand()) that returns any random integer in the
int range, write a wrapper method that returns a random number within a
specific range [min, max], assuming int.MinValue <= min <= max <= int.
MaxValue.
my solution was: min + (Rand() - int.MinValue) * (max - min + 1) / (int.
MaxValue - int.MinValue + 1), and use long type to account for overflow
issue. is this solution correct?
2. Given a M*N matrix where some cells are blocked and there may or may not
be a cell which ... 阅读全帖
【 以下文字转载自 PDA 讨论区 】
发信人: weidong (伊拉克学习小组副组长), 信区: PDA
标 题: 老码农骂小码农的强文。
发信站: BBS 未名空间站 (Mon Nov 2 19:52:49 2015, 美东)
Linus Tovalds骂瞎写代码的小码农,荡气回肠,应该下发所有码农学习。
Christ people. This is just sh*t
.The conflict I get is due to stupid new gcc header file crap. But what
makes me upset is that the crap is for completely bogus reasons.
This is the old code in net/ipv6/ip6_output.c:
mtu -= hlen + sizeof(struct frag_hdr);
and this is the new “improved” code that uses fancy stuff that wants
magical built-in... 阅读全帖
If you respond the first email politely, you might gain appreciation from
both his boss and him. For example, you tells him how to find out who
changes the file from some code management system to demonstrate your
leadership skill. Furthermore, you can even offer your help to restore the
file in the eyes of big boss. Your good deed will be recognized by the big
boss since the email is cc-ed to big boss. I would say you missed an
opportunity he gave you to move up in your career via ccing email t... 阅读全帖
A store in Poughkeepsie Galleria Mall is looking for a store Cashier.
It is close to New York City.
The store sells Asian Arts Stuff.
Flexible working time.
Chinese Speaker prefered.
Female prefered
For detail, Call Mr. liu at 646-645-5558
The store is in Stamford Town Center Connecticut.
地点: 100 Greyrock Place Stamford, CT 06901
要求:懂英文。
女性优先.
Flexible working time.
For detail, Call Mr. liu at 646-645-5558
本广告长期有效。
Crystal Mall Asian Arts store looking for store helper/cashier.
Flexible hours.
要求:懂英文。
请联系:刘先生(646)-645-5558
Address
850 Hartford Turnpike
Waterford, CT 06385