INFO2022
🧔:interviewer 👶:interviewee
🧔:Russell 你好,我是kevin,是今天這場面試的主持人,請你簡單自我介紹一下。
👶:Kevin你好,我來自台北,畢業於成功大學資訊工程研究所,研究所的主要研究領域是語音合成,成功開發的合成語言包含國語、台語、客語和印尼語。
🧔:請問你為什麼會想來面試這個職缺,是有相關的開發經驗嗎?
👶:在研究所有修過數位IC設計課程,對IC設計很有興趣和熱情,使用verilog實做過一些小型電路,例如:Pipeline CPU, LZ77 Encoder and Decoder, Edge-Based Line Average Interpolation 等…
🧔:好的,既然你有實作過 verilog 經驗的話,那麼請你幫我用C語言撰寫,在不使用division and mod情況下,判斷輸入一個非負整數是否為3的倍數,回傳Ture or False
👶:好的,在不使用division and mod情況下,我需要判斷一個非負整數是否可以被3整除
👶: 我會使用bitwise操作,
以下是我的操作步驟
// input n
// Step1: if n=0 or n=3, return Ture
// Stap2: if n<3, return False
// Step3: n>>2 + n&3
// step4: recursive
int isMult3(unsigned int n)
{
if ( n == 0 || n == 3 )
return 1;
if ( n < 3 )
return 0;
n = (n >> 2) + (n & 3);
return(isMult3(n));
}
🧔: 那麼如果輸入可以為負整數的話,你該如何解決?
👶: 如果輸入可能為負的話,則在第一步先將負數轉成正數,因為只是判斷是否被3整除,所以正負號對結果沒有影響
// input n
// Step0: if n is negative, convert to positive
// Step1: if n=0 or n=3, return Ture
// Stap2: if n<3, return False
// Step3: n>>2 + n&3
// step4: recursive
int isMult3(int n)
{
if (n>>31){
n ^= -1;
n += 1;
}
if ( n == 0 || n == 3 )
return 1;
if ( n < 3 )
return 0;
n = (n >> 2) + (n & 3);
return(isMult3(n));
}
🧔: 好的,那今天就先到這邊,謝謝你今天來參與我們的面試。
or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing