由买买提看人间百态

topics

全部话题 - 话题: tempe
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)

发帖数: 1
1
来自主题: JobHunting版 - SQL某startup面经,顺便求指点
某startup面经,感觉挺难,似乎还可以优化一点,有大神路过帮忙指点一下。
上次就是SQL挂了,不是很很有信心。
postgresql. 要求按照signup操作系统,工作日周一到周五分类,分别列出用户注册后
一天内使用
app某功能人数和当天注册用户的百分比。一个t_requests的表有使用的记录,temp是
提取出来的有关用户的表。
with id_succeed  as
(select temp.client_id
from t_requests as t inner join temp
on temp.client_id = t.client_id
where t.status = 'completed'
and
t.request_time is not null
group by temp.client_id
having min(t.request_time-temp.signup_time) < interval '24 hour'
)
select temp.OS_name, temp.day_id,
sum(
case when (s.client_id is ... 阅读全帖
H**7
发帖数: 8624
2
1/4/2011 00:00 PW AVG TEMP = 30.8
1/4/2011 01:00 PW AVG TEMP = 30.8
1/4/2011 02:00 PW AVG TEMP = 30.8
1/4/2011 03:00 PW AVG TEMP = 29.4
1/4/2011 04:00 PW AVG TEMP = 29.1
1/4/2011 05:00 PW AVG TEMP = 29.1
1/4/2011 06:00 PW AVG TEMP = 28.7
1/4/2011 07:00 PW AVG TEMP = 28.7
1/4/2011 08:00 PW AVG TEMP = 28.6
1/4/2011 09:00 PW AVG TEMP = 28.6
1/4/2011 10:00 PW AVG TEMP = 32.1
1/4/2011 11:00 PW AVG TEMP = 32.1
1/4/2011 12:00 PW AVG TEMP = 37.7
1/4/2011 13:00 PW AVG TEMP = 3... 阅读全帖
N***m
发帖数: 4460
3
来自主题: Programming版 - 编程题一道
看到c/c++笔试问题一道,估计是经典问题了。
=======================================
编程输出以下格式的数据。(趣味题)
a) When i=0
1
b) When i=1
7 8 9
6 1 2
5 4 3
c) When i=2
21 22 23 24 25
20 7 8 9 10
19 6 1 2 11
18 5 4 3 12
17 16 15 14 13
=============================
我用java写了一段程序,试了前几个i=1,2,3,4,能工作,但是感觉写的很罗嗦。
有没有更好的Idea?
======================
附:我的臃肿的java code.
[Main.java]
public class Main {
public stat... 阅读全帖
c**d
发帖数: 3888
4
如果去的法学院不是 Top-14,甚至不是 Top 50,没有很强的 patent 背景,希望你们
能避免弯路。下面的故事读起来像小说,但是我可以告诉你们,非常现实。
http://www.autoadmit.com/thread.php?thread_id=1905801&forum_id=2#20761498
In a couple short weeks, a new wave of hapless lemmings will crack open the
shrinkwrap on those heinously overpriced casebooks, boot up their laptops
for some heated note-taking, and commence their voyage down the road of
America’s most overrated, miserable, and saturated industry: the practice
of law. A pompous, overpaid professor will sau... 阅读全帖
a******e
发帖数: 119
5
来自主题: Statistics版 - R,用apply比用for loop 快?
for (g in 1:g)
{
for (m in 2:m)
{

lamda[m,]=sapply(Y[g,1:n],update.lamda)
beta[m]=rgamma(n=1,shape=n*alpha[m-1]+beta.shape,rate = (sum(lamda[m-1,]
)+beta.rate))
temp = rnorm(n=1,mean=alpha[m-1],sd=sigma)
den = (beta[m-1]^(n*alpha[m-1]))*((prod(lamda[m-1,]))^(alpha[m-1]-1))*(
exp(-alpha[m-1])*alpha.rate)/(gamma(alpha[m-1]))^n
num = (beta[m-1]^(n*temp))*((prod(lamda[m-1,]))^(temp-1))*(exp(-temp)*
alpha.rate)/(gamma(temp))^n
accep.prob=num/den

if((accep.prob>=u[... 阅读全帖

发帖数: 1
6
来自主题: DataSciences版 - SQL某startup面经,顺便求指点 (转载)
【 以下文字转载自 JobHunting 讨论区 】
发信人: superds2100 (superds), 信区: JobHunting
标 题: SQL某startup面经,顺便求指点
发信站: BBS 未名空间站 (Wed Aug 3 17:27:08 2016, 美东)
某startup面经,感觉挺难,似乎还可以优化一点,有大神路过帮忙指点一下。
上次就是SQL挂了,不是很很有信心。
postgresql. 要求按照signup操作系统,工作日周一到周五分类,分别列出用户注册后
一天内使用
app某功能人数和当天注册用户的百分比。一个t_requests的表有使用的记录,temp是
提取出来的有关用户的表。
with id_succeed  as
(select temp.client_id
from t_requests as t inner join temp
on temp.client_id = t.client_id
where t.status = 'completed'
and
t.request_time is not null
group by temp.... 阅读全帖
r******r
发帖数: 700
7
我当年的 homework,翻出来了。另一个 homework project, 帮我找到了第一个工作。
#ifndef LIST_H
#define LIST_H
#include
#include
#include
#include "node.h"
using namespace std;
/*=========================================================================*/
/**
* Implementation of a List ADT using a doubly-linked list.
*
* @version 1.0 2/25/05
*/
/*.........................................................................*/
/**
* Definition of exception handling class
*/
class ListEmpty : public ... 阅读全帖
p****e
发帖数: 3548
8
来自主题: JobHunting版 - flag新题
不知对不,欢迎测试
// Type your C++ code and click the "Run Code" button!
// Your code output will be shown on the left.
// Click on the "Show input" button to enter input data to be read
#include
using namespace std;
int findnotsubarray(vector &rlt, vector &temp, int &X, int a[],
int &length, int start)
{
if(start>=length) return 0;
for(int t=0; t<=X; ++t)
{
int i = start;
for(; i {
if(t==a[i])
{
... 阅读全帖
a*********4
发帖数: 7
9
来自主题: JobHunting版 - 一道面试题
a java solution:
import java.util.*;
public class FindNonDupeSubTree {
private class Node{
int val;
Node left;
Node right;
Node (int val){
this.val = val;
left = null;
right = null;
}
}

public boolean FindSubTree(Node root, Set nodeSet, ArrayList<
Integer> validTreeRoots){
if (root == null)
return true;
Set sleft = new HashSet();
Set ... 阅读全帖
a*********4
发帖数: 7
10
来自主题: JobHunting版 - 一道面试题
a java solution:
import java.util.*;
public class FindNonDupeSubTree {
private class Node{
int val;
Node left;
Node right;
Node (int val){
this.val = val;
left = null;
right = null;
}
}

public boolean FindSubTree(Node root, Set nodeSet, ArrayList<
Integer> validTreeRoots){
if (root == null)
return true;
Set sleft = new HashSet();
Set ... 阅读全帖
H**7
发帖数: 8624
11
12/28/2010 00:00 PW AVG TEMP = 28.1
12/28/2010 01:00 PW AVG TEMP = 28.1
12/28/2010 02:00 PW AVG TEMP = 28.1
12/28/2010 03:00 PW AVG TEMP = 27.3
12/28/2010 04:00 PW AVG TEMP = 27.0
12/28/2010 05:00 PW AVG TEMP = 26.8
12/28/2010 06:00 PW AVG TEMP = 26.5
12/28/2010 07:00 PW AVG TEMP = 26.5
12/28/2010 08:00 PW AVG TEMP = 26.2
12/28/2010 09:00 PW AVG TEMP = 26.2
12/28/2010 10:00 PW AVG TEMP = XXX
12/28/2010 11:00 PW AVG TEMP = 33.1
12/28/2010 12:00 PW AVG TEMP = 35.9
H**7
发帖数: 8624
12
1/1/2011 00:00 PW AVG TEMP = 40.8
1/1/2011 01:00 PW AVG TEMP = 40.8
1/1/2011 02:00 PW AVG TEMP = 39.2
1/1/2011 03:00 PW AVG TEMP = 39.2
1/1/2011 04:00 PW AVG TEMP = 38.4
1/1/2011 05:00 PW AVG TEMP = 38.4
1/1/2011 06:00 PW AVG TEMP = 37.4
1/1/2011 07:00 PW AVG TEMP = 37.4
1/1/2011 08:00 PW AVG TEMP = 36.4
1/1/2011 09:00 PW AVG TEMP = 36.4
1/1/2011 10:00 PW AVG TEMP = 37.1
1/1/2011 11:00 PW AVG TEMP = 39.8
1/1/2011 12:00 PW AVG TEMP = 41.5
b******7
发帖数: 92
13
来自主题: JobHunting版 - 透露两个G的onsite题
ListNode * add(ListNode * a, ListNode * b)
{
if(a == NULL || b == NULL) return NULL;
ListNode * head = NULL;
ListNode * pre = NULL;
ListNode * preLess9 = NULL;
for(; a != NULL; a = a->next, b = b->next)
{
ListNode * temp = new ListNode(a->val, b->val);
if(pre != NULL)
pre->next = temp;
else
head = temp;
... 阅读全帖
l********1
发帖数: 24
14
来自主题: JobHunting版 - rocket fuel第一轮面经
void dfs(int n1, int n2, int n3, string transfer, set &dict){
if(n1 == 0 && n2 == 0 && n3 == 0){
if(dict.find(transfer) == dict.end()){
dict.insert(transfer);
cout< }
return;
}
if(transfer.size() == 0){
if(n1 > 0){
string temp = "()";
dfs(n1 - 1, n2, n3, temp, dict);
}
if(n2 > 0){
string temp = "[]" ;
dfs(n1, n2 - 1, n3, temp, dict); ... 阅读全帖
S*******C
发帖数: 822
15
http://oj.leetcode.com/problems/subsets/
第一种格式:res作为局部变量避免线程安全问题,但比较啰嗦
public ArrayList> subsets(int[] num){
if(num==null) return null;
Arrays.sort(num);
ArrayList> res=new ArrayList>(
);
res.add(new ArrayList());// [[]]
dfs(res, num,0,new ArrayList());
return res;
}
private void dfs(ArrayList> res, int[] num, int pos,
ArrayList temp){... 阅读全帖
H**7
发帖数: 8624
16
1/3/2011 00:00 PW AVG TEMP = 29.5
1/3/2011 01:00 PW AVG TEMP = 29.5
1/3/2011 02:00 PW AVG TEMP = 29.5
1/3/2011 03:00 PW AVG TEMP = 27.4
1/3/2011 04:00 PW AVG TEMP = 26.9
1/3/2011 05:00 PW AVG TEMP = 26.9
1/3/2011 06:00 PW AVG TEMP = 26.1
1/3/2011 07:00 PW AVG TEMP = 26.1
1/3/2011 08:00 PW AVG TEMP = 25.4
1/3/2011 09:00 PW AVG TEMP = 25.4
1/3/2011 10:00 PW AVG TEMP = 30.0
1/3/2011 11:00 PW AVG TEMP = 30.0
k****e
发帖数: 126
17
来自主题: Programming版 - 问个超简单的C问题
If a[][] is declared as static storage duration then it will certainly go to
.data segment. If not, the compiler will probably use immediate value
instead.
If you compare the following, (gcc version 4.5.3 -O0)
(1) array a[] has "auto" storage duration.
#include
#include
int foo()
{
int a[] = {3, 4, 5};
return a[2];
}
int main(void)
{
int temp;
temp = foo();
printf("%d", temp);
return 0;
}
Sections:
Idx Name Size VMA LMA File ... 阅读全帖
s******y
发帖数: 352
18
filename temp temp;
data _null_;
length temp $200.;
retain temp;
file temp;
infile datalines eof=end;

input;

if not missing(temp) and prxmatch("/^\s*\d{3}\s*/",scan(_infile_,1,
','))=0
then do;
temp=cats(temp,_infile_);
return;
end;
else if _n_>1 and prxmatch("/^\s*\d{3}\s*/",scan(_infile_,1,','))>0
then put temp;
temp=_infile_;
return;
end:put temp;
da... 阅读全帖
h**6
发帖数: 4160
19
来自主题: JobHunting版 - 一道老题
我把二叉树版本写出来了,大家研究一下:
void duplicate(BSTNode* A)
{
if(A == NULL)
return;
BSTNode* temp = new BSTNode;
temp->left = A->left;
temp->right = A->right;
A->left = temp;
A->right = NULL;
duplicate(temp->left);
duplicate(temp->right);
}
void copy(BSTNode* A)
{
if(A == NULL)
return;
BSTNode* temp = A->left;
if(A->random == NULL)
temp->random = NULL;
else
temp->random = A->random->left;
copy(temp->left);
copy(temp->righ
t*********n
发帖数: 89
20
发个自己的吧,请指正...努力学习2爷中...
int maxProfit3(vector &prices) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
if(!prices.size())
return 0;
vector a;
vector b;
vector::iterator it;
int min = prices[0];
int profit = 0;
for(it=prices.begin(); it if(*it min = *it;
int temp = *it - min;
if(temp > profit){
a.push_back(temp);
prof... 阅读全帖
t*********n
发帖数: 89
21
发个自己的吧,请指正...努力学习2爷中...
int maxProfit3(vector &prices) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
if(!prices.size())
return 0;
vector a;
vector b;
vector::iterator it;
int min = prices[0];
int profit = 0;
for(it=prices.begin(); it if(*it min = *it;
int temp = *it - min;
if(temp > profit){
a.push_back(temp);
prof... 阅读全帖
p********r
发帖数: 66
22
20 行
public int candySimple(int[] ratings){
if(ratings == null || ratings.length == 0) return 0;
if(ratings.length == 1) return 1;
int[] temp = new int[ratings.length];
temp[0] = 1;
for(int i = 1; i < ratings.length; i++){
if(ratings[i] > ratings[i-1])
temp[i] = temp[i-1] + 1;
else temp[i] = 1;
}
temp[ratings.length - 1] = Math.max(1, temp[ratings.length - 1]);
int last = 1, tota... 阅读全帖
H**********5
发帖数: 2012
23
来自主题: JobHunting版 - 感觉今天结结实实被烙印阴了
#include
#include
typedef struct node
{
int data;
struct node* next;
};
void printfList(struct node *head)
{
while(head!=NULL)
{
printf("%d-> ",head->data);
head=head->next;
}
printf("\n");
}
void pushAtBegin(struct node **head_ref,int data)
{
struct node *new_node=(struct node*)malloc(sizeof(struct node));
new_node->data=data;
new_node->next=*head_ref;
*head_ref=new_node;
}
void pushAtEnd(struct node **head_ref,i... 阅读全帖
s******7
发帖数: 1091
24
来自主题: Programming版 - 请教函数 INIT 怎么能free memory
请教函数 INIT 怎么能free temp
把 free(temp) 放在 return 0; 后不可以吗?
我试着把free(temp) 放在 return 0; 前面. 总会报错
象这种情况是不是不需要 free(temp)?
#include
using namespace std;
typedef struct stackT{
int value;
struct stackT *next;
} stack;
int init(stack **head, int j){
int i;
stack *temp;
temp=NULL;
for (i=1;i<(j+1);i++){
temp=(stack *)malloc(sizeof(stack));
temp->value=i;
temp->next=*head;
*head=temp;
}
return 0;
free(temp); //问题出在这里
w*********r
发帖数: 42116
25
来自主题: Military版 - 美国最冷的20个主要城市。
#20: Boston (Avg. Dec-Feb Temp: 31.8 degrees)
#19: Kansas City (Avg. Dec-Feb Temp: 31.3 degrees)
Kansas City's all-time record low was -23 degrees set on Dec. 22 and 23,
1989.
#18: Denver (Avg. Dec-Feb Temp: 31.2 degrees)
Denver's all-time record low was -29 degrees set on Jan. 9, 1875.
#17: Pittsburgh (Avg. Dec-Feb Temp: 31.1 degrees)
Pittsburgh's all-time record low was -22 degrees set on Jan. 19, 1994.
#16: Colo. Springs (Avg. Dec-Feb Temp: 30.8 degrees)
Colorado Springs' all-time record low ... 阅读全帖
w*********r
发帖数: 42116
26
来自主题: Military版 - 美国最冷的20个主要城市。
#10: Ft. Wayne, Ind. (Avg. Dec-Feb Temp: 27.4 degrees)
Ft. Wayne's all-time record low was -24 degrees set on Jan. 12, 1918.
#9: Buffalo (Avg. Dec-Feb Temp: 27.1 degrees)
Buffalo's all-time record low was -20 degrees set on Feb. 2, 1961 and Feb. 9
, 1934.
#8: Rochester, N.Y. (Avg. Dec-Feb Temp: 27 degrees)
Rochester's all-time record low was -22 degrees set on Feb. 9, 1934.
#7: Lincoln, Neb. (Avg. Dec-Feb Temp: 26.8 degrees)
Lincoln's all-time record low was -33 degrees set on Jan. 12, 1974.
#6:... 阅读全帖
g*******n
发帖数: 214
27
来自主题: JobHunting版 - G电面一题
如果不用recursion的话代码太长是不是面试的时候不能用?
public ArrayList numString2Char(String num) {
//map to store all the previous possibilities
HashMap> map = new HashMap ArrayList>();
int[] numbers = new int[num.length()];
for (int i = 0; i < num.length(); i++) {
numbers[i] = Integer.parseInt(num.charAt(i) + "");
}
if(numbers[0]==0) return null;
ArrayList tempList;
... 阅读全帖
m*******1
发帖数: 168
28
来自主题: JobHunting版 - 问个递归的问题
不好意思,我基础太差了,在leetcode上遇到好几道类似的题目,每次在同一个地方总
是弄不明白,希望同学们能帮我讲解下,帮助和我一样有困惑的人,先谢谢大家啦!
Given two integers n and k, return all possible combinations of k numbers
out of 1 ... n.
For example,
If n = 4 and k = 2, a solution is:
[
[2,4],
[3,4],
[2,3],
[1,2],
[1,3],
[1,4],
]
//solution
public ArrayList> combine(int n, int k)
{
ArrayList> res= new ArrayList
>();
ArrayList temp= new ArrayList ();
... 阅读全帖
m******3
发帖数: 346
29
在local没问题,code如下,可能是什么原因呢?
vector findSubstring(string s, vector& words) {
int wordLen = words[0].size();
map expectedCount;
map actualCount;
for (int i=0; i expectedCount[words[i]] = expectedCount[words[i]]++;
}
vector res;
for (int i=0; i int left = i;
int count = 0;
for (int j=i; j<=(int)s.length()-wordLen;j=j+... 阅读全帖
H**7
发帖数: 8624
30
12/22/2010 11:00 PW AVG TEMP = 40.1
12/22/2010 12:00 PW AVG TEMP = 41.3
12/22/2010 13:00 PW AVG TEMP = 41.3
12/22/2010 14:00 PW AVG TEMP = 43.2
12/22/2010 15:00 PW AVG TEMP = 43.6
12/22/2010 16:00 PW AVG TEMP = 43.4
12/22/2010 17:00 PW AVG TEMP = 42.4
12/22/2010 18:00 PW AVG TEMP = 40.7
12/22/2010 19:00 PW AVG TEMP = 38.5
12/23/2010 01:00 PW AVG TEMP = 35.8
g****c
发帖数: 20
31
来自主题: Computation版 - c++为什么比c慢?
I see. But how to avoid creating temporary structures in overloading
operators? In the function below, the variable temp is used to store the
intermediate step of data manipulation. How to get around it? thx
Time operator+(const Time& lhs, const Time& rhs)
{
Time temp = lhs;
temp.seconds += rhs.seconds;
if (temp.seconds >= 60)
{
temp.seconds -= 60;
temp.minutes++;
}
temp.minutes += rhs.minutes;
if (temp.minutes >= 60)
{
temp.minutes -= 60;
temp.hours++
s******n
发帖数: 3946
32
来自主题: JobHunting版 - 感恩发面经-Amazon第三轮电面
用一个List存放当前Open的XML tag。
每来一个数组,假设0~i匹配List的0~i,首先要关闭List里面i后面的所有tag,然后再
Push新来数组的i后面的所有Tag到List后面
所有数组跑完后再关闭List上所有的Tag
List temp;
String [][]input;
for (int i=0; i String[] sentence = input[i];
int cursor;
for (cursor=0; cursor +) {
if (!sentence[cursor].equals(temp[cursor]) break;
}
int closeTags = 0;
for (int j=temp.length()-1; j>=cursor; --j) {
printf("");
... 阅读全帖
s****e
发帖数: 638
33
来自主题: JobHunting版 - 这题有最优解法么
扫描一遍数组,<=0的数字不管,大于数组长度的数字扔掉,其余的重新排列在数组中

扫描第二遍,返回第一个小于等于0的数组index。
int findPosMissing(int* arr, int size) {
for (int i=0; i if (arr[i] == i+1) continue;
int temp = arr[i];
arr[i] = 0;
int temp1;
while (true) {
if (temp <=0 ) break;
if (temp > size ) break;
if (arr[temp-1] == temp) break;
temp1 = arr[temp-1];
arr[temp-1]= temp;
temp = temp1;
}
}
for (int i=0; i if (arr[i]<=0){
return i+1;
... 阅读全帖
s****e
发帖数: 638
34
来自主题: JobHunting版 - 这题有最优解法么
扫描一遍数组,<=0的数字不管,大于数组长度的数字扔掉,其余的重新排列在数组中

扫描第二遍,返回第一个小于等于0的数组index。
int findPosMissing(int* arr, int size) {
for (int i=0; i if (arr[i] == i+1) continue;
int temp = arr[i];
arr[i] = 0;
int temp1;
while (true) {
if (temp <=0 ) break;
if (temp > size ) break;
if (arr[temp-1] == temp) break;
temp1 = arr[temp-1];
arr[temp-1]= temp;
temp = temp1;
}
}
for (int i=0; i if (arr[i]<=0){
return i+1;
... 阅读全帖
r******g
发帖数: 13
35
来自主题: JobHunting版 - leetcode上的4Sum一问
O(n^3),
Run Status: Accepted!
Program Runtime: 8 milli secs
Progress: 15/15 test cases passed.
Run Status: Accepted!
Program Runtime: 336 milli secs
my hashtable solution O(n^2) exceeds memory limit, if anyone has code(O^2)
passing OJ, please let me know.
class Solution {
public:
vector > fourSum(vector &num, int target) {
// Start typing your C/C++ solution below
// DO NOT write int main() function

vector > results;
int n = num.siz... 阅读全帖
g***j
发帖数: 1275
36
来自主题: JobHunting版 - 问一个atoi overflow的问题
我这样写的,可以么?
虽然大小集合都过了,但是,感觉还是有一个bug,因为直接求abs(INT_MIN) 会
overflow,所以,我直接用INT_MAX来代替了。
只贴了中间的while循环
while(*index >= '0' && *index <= '9') {

int val = *index -'0';

int temp = result;

for(int i = 0; i < 9; i++) {
if(sign > 0) {
if(INT_MAX - temp > result) temp += result;
else return INT_MAX;
} else {
if(INT_MAX - temp > result) ... 阅读全帖
r*c
发帖数: 167
37
来自主题: JobHunting版 - simple question
using System;
using System.Collections.Generic;
namespace WinningGame
{
class Program
{
static void Main(string[] args)
{
int nCount = 0;
int nTotalGames = 1000;
for (int i = 0; i < nTotalGames; i++)
{
Board bd = new Board();
//bd.PrintBoard();
bool bResult = bd.IsWinner();
if (bResult)
{
nCount++;
bd.Print... 阅读全帖
e*******8
发帖数: 94
38
来自主题: JobHunting版 - hackerrank上的A journey to the Moon
求指点。。。
我的代码,不知道为什么所有的case都可以过,就是第11个test case怎么都过不了
,不解啊不解 >_<~~
用的是union-find的数据结构,CLRS书上的算法
想法就是用hashtable记录每个connected component,然后有了每个component的大小
之后用totalpairs计算最后的结果
void makeset(int x, unordered_map> &table)
{
table[x] = {x,1};
}
int findset(int x, unordered_map> &table)
{
auto &temp = table[x];
if (temp.first != x)
temp.first = findset(temp.first, table);
return temp.first;
}
void setunion(int x, int y, unordered_map阅读全帖
z**a
发帖数: 69
39
好角度,写了个,过了LC,差不多是非递归中序遍历二叉树的思路。
class Solution {
public:
class stack
{
public:
char c;
int flag;
stack(char c, int flag)
{
this->c = c;
this->flag = flag;
}
};
vector generateParenthesis(int n) {
int left = 0;
int right = 0;
vectorrecord;
vectorresult;
stack temp(0,0);
record.push_back(stack('(', 0));
le... 阅读全帖
s**********l
发帖数: 395
40
Sorry, I cannot type in Chinese now.
Hi All,
I need to use the combination conditions of two variables: temp1 or temp2
and another eight variables: c01-c08 to define the value of r1 and r2.
However, I did not get what I wanted.
The data and the results should be like this(only selected several variables
):
C08 C05 C07 C02 temp1 temp2 r1 r2
1385 6 4 74 0.8 0.2 60 103
445 4 5 91 0.2 0.7 103 103
170 15 5 67 0.1 0.5 12 ... 阅读全帖
x**n
发帖数: 1936
41
【 以下文字转载自 sysop 讨论区 】
发信人: xian (海底核爆掀巨浪, 倒海翻江找扶桑), 信区: sysop
标 题: 《别了,可耻的cynic与可悲的TempBM》
发信站: BBS 未名空间站 (Sat Jan 1 01:20:24 2011, 美东)
又一年结束了。 在过去的一年里,我被军版封了无数次。特别是那个被贪官二奶包的
小白脸和那个在加拿大养不起女儿靠领救济过日子的 cynic 封我删我简直到了登峰造
极的程度。
也就是在前天,那个cynic,在我发了个嘲弄那所谓四代铁疙瘩的帖子后,好象捅了他
党娘的G点,it把我封了7天。他爷爷我不服气,找版主TempBM问理,24小时没见动静。
我写信再探再问,结果Temp说,是因为我帖子的口气不对因此给封的。
尽管Temp把我解封了。 可这莫须有的罪名实在让人气不过,所以我就把我的原帖子又
贴了上去,要cynic给个解释。 可cynic一句没有解释, 又把我给封了。 这下,我再
去问Temp, 可这时的Temp却说我pa人了。 我说:“同样的帖子,刚才你说我昨天被封
是口气不好,话音未落,你现在又说我pa了。 那请... 阅读全帖
m**l
发帖数: 11854
42
【 以下文字转载自 board 讨论区 】
发信人: xian (海底核爆掀巨浪, 倒海翻江找扶桑), 信区: board
标 题: 《别了,可耻的cynic与可悲的TempBM》 (转载)
发信站: BBS 未名空间站 (Sat Jan 1 01:24:13 2011, 美东)
发信人: xian (海底核爆掀巨浪, 倒海翻江找扶桑), 信区: sysop
标 题: 《别了,可耻的cynic与可悲的TempBM》
发信站: BBS 未名空间站 (Sat Jan 1 01:20:24 2011, 美东)
又一年结束了。 在过去的一年里,我被军版封了无数次。特别是那个被贪官二奶包的
小白脸和那个在加拿大养不起女儿靠领救济过日子的 cynic 封我删我简直到了登峰造
极的程度。
也就是在前天,那个cynic,在我发了个嘲弄那所谓四代铁疙瘩的帖子后,好象捅了他
党娘的G点,it把我封了7天。他爷爷我不服气,找版主TempBM问理,24小时没见动静。
我写信再探再问,结果Temp说,是因为我帖子的口气不对因此给封的。
尽管Temp把我解封了。 可这莫须有的罪名实在让人气不过,所以我就把... 阅读全帖
b******n
发帖数: 4509
43
来自主题: JobHunting版 - 一到电面题

if (head == NULL || head->next == NULL) return;
Node *temp = head->next, *temp2 = NULL;
if (temp->next == NULL || temp->next->next == NULL)
head->next = temp->next;
else {
head->next = temp->next->next;
temp2 = temp->next;
}
temp->next = head;
reversePairsOfLinkList(temp2 == NULL? temp->next : temp2);
g*****i
发帖数: 2162
44
来自主题: JobHunting版 - 贡献两道店面题
写了一个要extra space的
private static int findCycleNum(int[] input){
if(input==null||input.length<1)
return -1;
int len=input.length;
int[] visited=new int[len];
int visitedCount=0; //shorcut if all is visited
int cycleCount=0;
int temp;
boolean newCycle=false;
for(int i=0;i if(visited[i]==1)
continue;
temp=i;
newCycle=true;
while(temp if(visited[temp]==0){
visited[temp]=1;
... 阅读全帖
e***s
发帖数: 799
45
来自主题: JobHunting版 - 问个Amazon面试题
public static int FindNext(int x)
{
ArrayList tempa = new ArrayList();
int current = x % 10;
int temp = x / 10;
int result;
while (temp > 0)
{
tempa.Add(current);
//find the falling edge from right to left, e.g. "1321" 1->2
->3->(1)falling edge
if (current > temp % 10)
{
//switch the fall edge with first element which greater
than its... 阅读全帖
e***s
发帖数: 799
46
来自主题: JobHunting版 - 问个Amazon面试题
public static int FindNext(int x)
{
ArrayList tempa = new ArrayList();
int current = x % 10;
int temp = x / 10;
int result;
while (temp > 0)
{
tempa.Add(current);
//find the falling edge from right to left, e.g. "1321" 1->2
->3->(1)falling edge
if (current > temp % 10)
{
//switch the fall edge with first element which greater
than its... 阅读全帖
d****n
发帖数: 233
47
来自主题: JobHunting版 - 直方图下雨这道题怎么解?
You can scan from left to right and from right to left.
int trap(int A[], int n) {

int total = 0;
int temp = 0;
int h = 0;
for (int i = 0; i < n; i++) {
if (A[i] < h) {
temp += h - A[i];
} else {
total += temp;
h = A[i];
temp = 0;
}
}

h = 0;
temp = 0;
for (int i = n-1; i >=0; i--) {
... 阅读全帖
d**e
发帖数: 6098
48
来自主题: JobHunting版 - [合集] 如何跟startup谈条件
☆─────────────────────────────────────☆
zzq2861105 (哇哈哈) 于 (Wed Jul 4 21:28:06 2012, 美东) 提到:
明天要去一个start—up公司谈工作的事情,HR一定要我开这么长时间车过去,我估计
是觉得我没什么经验,想一次性搞定我,不让我有考虑的时间和余地。 应该主要是工
资,签证,股票这几个方面的问题。 不知道有谁有什么建议吗? 或者发个总结的帖
子的地址给我,我想系统地准备下
从别处摘来的,分享一下:
工资谈判最重要的是告诉对方你值多少钱,而不是你需要多少钱。
错误方式一:我有老婆有孩子还刚刚买了房子,老爷太太多赏几个大子儿吧 (直接去
地铁站吧,不送啦)。
错误方式二:我有offer二三四五六,你不给我加钱我去别家了(心里可以这么想但不
能这么说,吃相不能太难看)。
错误方式三:我同学我同事我亲戚我朋友都拿多少多少钱(四大牛人在mitbbs上显摆显
摆就算了千万别当真,人家关你什么事),或者amazon google facebook microsoft
IBM walmart McDona... 阅读全帖
c*********i
发帖数: 46
49
来自主题: JobHunting版 - Count Inversions 求助
http://www.geeksforgeeks.org/counting-inversions/
给出了代码,可是看了程序后, 有点不解,想请大牛指教一下:
/*this is tricky -- see above explanation/diagram for merge()*/
inv_count = inv_count + (mid - i);
不应该是:
inv_count = inv_count + (mid - i)+1?
当copy a[j]时,left array 剩下的都是inversion,不应该是(mid - i)+ 1 个吗?
int merge(int arr[], int temp[], int left, int mid, int right)
{
int i, j, k;
int inv_count = 0;
i = left; /* i is index for left subarray*/
j = mid; /* i is index for right subarray*/
k = left; /*... 阅读全帖
a**********0
发帖数: 422
50
来自主题: JobHunting版 - 关于reorder list 的总结
我本来用递归方法 但是超时了 本身代码没错 就是慢 为什么慢 因为在每个递归函数
中有O(n)的操作 这样n次递归导致总体O(n平方)
如果坚持递归方法 需要返回调整好的list的尾节点的下一个节点 这个是从网友那里学
来的 其实这个过程有点tricky 为什么不简单返回 list的头节点或者尾节点 而要返
回尾节点的下一个节点呢? 思路是这样的 尾节点经过调整已经不是原来的尾节点了
它指向的下一个已经不是原来的顺序 那为什么不返回头节点呢 ? 头节点其实不需要
返回 每次用next找就可以了 而且每次拿到头节点也不好用 必须多次next找到尾节点
又超时了
网友的方法 我改编成了java的 后边也有返回尾节点的方法
但是很容易出错 如果面试 还是用循环而不是递归的方法 当然面试无法检查是不是超
时 所以用我最早的方法也可以吧
/**
* Definition for singly-linked list.
* class ListNode {
* int val;
* ListNode next;
* ListNode(int x) {
* ... 阅读全帖
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)