噗,一次尷尬的面試經歷
算起來辭職有一個月了,自宅“葛優躺”10天,火車上幹坐2天,祖屋接受來自お母さんの 教育7天,北京探望大學學友2天,正式投入找工作大概也就10天,之間還要扣除各路同學各色問候(線上爐石線下隔壁屋)。過了一遍TCP,過了一遍C++多型&繼承&blabla,過了一遍redis,過了一遍mysql,抽了幾段空子刷了一些題,自知荒蕪了大半個月的歲月(還沒算上個月MHOL刷怪),崗位都是輕輕的收藏了,尋思著先隔岸觀火,:)。
今天面試前因後果是這樣的:hr搜尋到了我的簡歷->簡單詢問->誒,可以一試->電話面試->然後就是今天的face 2 face。昨天電面之後說安排今天面試,我不假思索就應之,想著應該不會或許死的很尷尬。噗,往往現實會讓你死的很豐滿。
面1:輸出0-999999的一個數字比如123456的英文描述
一直在糾結構造一個完美的欄位對映,並且還把英文搞錯了,million被我以為是“萬”的單位……搗鼓了半天,卒。然後是問了一些簡單的基礎題目,過程險象環生,發現敲程式碼的手怎麼也不會寫字了,一要手寫程式碼或者資料,腦子就空白了,構造string類、operate new這些都回答的磕磕絆絆,甚至不斷懷疑自己的回答……
面2:專案相關
換了個面試官,問了一些專案問題,自詡對專案還算比較瞭解,發現被完全喀擦了,介紹專案中的東西發現說不出什麼……腦子持續黑白了開始,後面幾個對專案的改進也是完全懵了……情況有點尷尬,面試官出了個 單鏈表排序的題 想緩解一下氣氛,- -。然而,對於此時有點崩的我,我大眼瞪小眼了半天題目,尷尬的繳械投降……
面3:
問了一些離職情況,專業情況,此時已經滿臉黑線的我,回答的也都是蠻差,然後,又是一個題,英文單詞倒序輸出,(Oh my god,讓我一次崩個夠),一崩到底。(回去的地鐵上發現只需要先倒序所有然後按空格倒序各個單詞……)
鐵定是沒戲。
也算給自己敲了個警鐘。順帶做個記錄。
static關鍵字、stl、operate new和throw(這題現在回想的還不是很清楚)、分詞、分散式的理解、塊儲存……
把三道演算法題回來寫了一遍,寫的不是很完善,= =,算給自己一個交代。
0-999999輸出英文描述
#include <stdio.h>
#include <iostream>
#include <string.h>
using namespace std;
const string ones[15] = {" ","one","two","three","four","five","six","seven","eitht","nine"};
const string tens[15] = {"ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eithteen","nineteen"};
const string tentys[15] = {" "," ","twenty","thirty","forty","fifty","sixty","seventy","eighty","nighty"};
const string bases[10] = {"hundred","thousand"};
int phraseInt(int num,int numMatrix[6])
{
for(int i=0;i<6;i++)
{
numMatrix[i] = 0;
}
int size = 1;
while(true)
{
numMatrix[6-size] = num%10;
if (0 == num/10)
break;
num = num/10;
++size;
}
return size;
}
void PhraseTri(int a[],int pos,string &desc)
{
if (0 != a[pos])
{
desc.append(ones[a[pos]]+" hundred");
if (a[pos+1] == 0 && a[pos+2] == 0)
return true;
desc.append(" and ");
}
if (a[pos+1] == 1)
desc.append(tens[a[pos+2]]);
else
desc.append(tentys[a[pos+1]]+"-"+ones[a[pos+2]]);
cout<<desc<<endl;
return true;
}
int main(int argc, char const *argv[])
{
int a[6];
int size = phraseInt(999999,a);
cout<<"size is :"<<size<<endl;
for(int i=0;i<6;i++)
{
cout<<a[i];
}
cout<<endl;
int i = 0;
string desc = "";
PhraseTri(a,0,desc);
desc.append(" thousand ,");
PhraseTri(a,3,desc);
cout<<"final desc is :"<<desc<<endl;
return 0;
}
英文單詞倒序輸出
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
using namespace std;
void reverse(char *p,int n)
{
int i = 1;
char tmp;
while( i <= n/2)
{
cout<<"n:"<<n<<" "<<"i:"<<i<<" "<<"data:"<<p[i-1]<<" and "<<p[n-i]<<endl;
tmp = p[i-1];
p[i-1] = p[n-i];
p[n-i] = tmp;
++i;
}
}
int main(int argc, char const *argv[])
{
string str = "I am a student in china ";
char * pStr = (char*)malloc(sizeof(char)*str.size());
strncpy(pStr,(char*)str.c_str(),str.size());
reverse(pStr,strlen(pStr));
cout<<pStr<<endl;
char * pTmpStr = pStr;
char * front = pStr;
int k = 0;
while('\0' != *pTmpStr)
{
cout<<"k value is "<<k++<<endl;
if (' ' == *pTmpStr)
{
reverse(front,pTmpStr-front);
cout<<(*front)<<endl;
front = pTmpStr+1;
cout<<(*(pTmpStr+1))<<endl;
}
++pTmpStr;
}
cout<<"final str is :"<<endl<<pStr<<endl;
return 0;
}
單鏈表排序(冒泡)
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
using namespace std;
typedef struct LinkNode
{
int data;
LinkNode * next;
}Node;
Node *head = NULL;
void createNode()
{
head=(Node*)malloc(sizeof(Node));
if (NULL == head)
{
cout<<"[ERROR] malloc memory fail !";
return;
}
head->data = -1;
head->next = NULL;
}
void Insert(Node *node)
{
if (NULL == head)
{
cout<<"[ERROR] head is null !";
return;
}
node->next = head->next;
head->next = node;
}
void show(Node *node)
{
while(NULL != node)
{
cout<<node->data<<" ";
node=node->next;
}
cout<<endl;
}
int k = 0;
void BubbleSort()
{
Node *pNodeTem = head->next;
Node *pNodePre = head;
Node *pLast = NULL;
Node *PLasPre = NULL;
while (1)
{
while ( NULL != pNodeTem->next)
{
if (pNodeTem->data > pNodeTem->next->data)
{
Node *NodeNext = pNodeTem->next;
pNodeTem->next = NodeNext->next;
NodeNext->next = pNodeTem;
pNodePre->next = NodeNext;
pNodePre = pNodePre->next;
pLast = pNodeTem;
}
else
{
pNodeTem = pNodeTem->next;
pNodePre = pNodePre->next;
}
}
pNodeTem = head->next;
pNodePre = head;
if (pLast == PLasPre)
break;
else
PLasPre = pLast;
cout<<"At "<<k++<<" times"<<endl;
show(head->next);
}
}
int main(int argc, char const *argv[])
{
/* code */
createNode();
for(int i = 0;i<100;i++)
{
Node *node = (Node*)malloc(sizeof(Node));
node->data = rand()%100;
Insert(node);
}
show(head->next);
BubbleSort();
return 0;
}
ps.英語需加把勁,寫程式碼大部分時間糾結方法變數取什麼英文名好……
以上