kinli blog

2018年12月30日 星期日

LeetCode-Search Insert Position

題目:
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.
You may assume no duplicates in the array.
Example 1:
Input: [1,3,5,6], 5
Output: 2

解說:
給定一排列過且沒重複元素的陣列跟一個目標值,回傳目標值在這個陣列插入的位置索引值。
先考慮corner case的情況,再處理一般狀況。


int searchInsert(int* nums, int numsSize, int target) {
    int inser_position=0;
    for(int i=0;i<numsSize;i++)
    {
        //目標值比第一個元素小
        if((*(nums+i)>target)&(i==0))
        {   
            inser_position=0;
            break;
        }
        
        //目標值比最後一個元素大
        if((*(nums+i)<target)&(i==(numsSize-1)))
        {   
            inser_position=numsSize;
            break;
        }
        
        if(*(nums+i)<target)
            inser_position=i;
        else if(*(nums+i)==target)
        {
            inser_position=i;
            break;
        }
        else
        {
            inser_position++;
            break;
             
        }   
    }   
    return inser_position;
}

2018年12月16日 星期日

LeetCode-Remove Element #27

題目:
Given an array nums and a value val, remove all instances of that value in-place and return the new length.
Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory.
The order of elements can be changed. It doesn't matter what you leave beyond the new length.
Example 1:
Given nums = [3,2,2,3], val = 3,

Your function should return length = 2, with the first two elements of nums being 2.

It doesn't matter what you leave beyond the returned length.
解說:
給定一整數陣列nums,並移除指定的值val
修改原來的陣列並回傳新的長度


int removeElement(int* nums, int numsSize, int val) {
  
    int index=0;

    for(int i=0;i<numsSize;i++)
    { 
        if(*(nums+i)!=val)//只要依序填入非指定移除的值就可以了!
        {
           *(nums+index)=*(nums+i);
            index++;
        }
    }
    
    return index;
}

2018年9月2日 星期日

Delta Heavy x Dirty Audio feat HOLLY - Stay (停留)

 Delta Heavy x Dirty Audio feat HOLLY - Stay (Maduk Remix)


I'll let it go
我將放手
I'll breathe you in like smoke
像抽菸般將你吸進
I'll taste that Cuban toke
我將品嚐那古巴煙味
Only the best for me
對我而言是最好的
Years go
年復一年
You've got a hold on me
你已經佔據我了
Aid in my reverie
幫我實現我的夢想
My reverie
我的夢想

I've been running out of time to be wasting
我已經沒有時間浪費了
Now I'm running out of air
現在我快耗盡空氣
You're running on my mind
我不停的想起你
Now I'm awakened, awakened
如今我清醒了,清醒了
I've been looking for the light, I'm holding on
我一直在尋找光明,我堅持下去
I'm trying to lose the fear
我試著不再有恐懼
It's running on my mind
我不停的想起
It's running on my mind
我不停的想起

Stay with me tonight
今晚陪著我
And we can make it better
我們可以做得更好
Just you and I all night
整晚只有你和我
And we can make it better
我們可以做得更好

I've been running out of time to be wasting
我已經沒有時間浪費了
Now I'm running out of air
現在我快耗盡空氣
You're running on my mind
我不停的想起你
Now I'm awakened, awakened
如今我清醒了,清醒了
I've been looking for the light, I'm holding on
我一直在尋找光明,我堅持下去
I'm trying to lose the fear
我試著不再有恐懼
It's running on my mind
我不停的想起
It's running on my mind
我不停的想起

I've been running out of time to be wasting
我已經沒有時間浪費了
Now I'm running out of air
現在我快耗盡空氣
You're running on my mind
我不停的想起你
Now I'm awakened, awakened
如今我清醒了,清醒了
I've been looking for the light, I'm holding on
我一直在尋找光明,我堅持下去
I'm trying to lose the fear
我試著不再有恐懼
It's running on my mind
我不停的想起
It's running on my mind
我不停的想起

Stay with me tonight
今晚陪著我
And we can make it better
我們可以做得更好
Just you and I all night
整晚只有你和我
And we can make it better
我們可以做得更好

2018年8月16日 星期四

Matrix & Futurebound - Happy Alone(快樂獨自) ft. V Bozeman

Matrix & Futurebound - Happy Alone ft. V Bozeman


"Everything came from nothing and so can you"
謹以此自勉

I hope it's not too late for me
希望對我來說還不算太遲
Been driving too fast along this road
已經沿著這條路開得太快有一陣子了
Will I survive this if I pray for hope, I hope, whoa
如果我祈求希望的話能活過這次嗎?我希望,哇
Sometimes it's hard to put the gun down
有時候放下權力是件困難的事
It's heading back there every single hour
每一個小時返回那處
The demons remain I know oh oh oh
我知道魔鬼依舊仍在 喔喔喔
This is not a song about love,
這不是首關於愛的歌
'Cause I'm happy alone
因為我是快樂單身
Won't sing about, don't know nothin' about love
不再唱關於愛的歌 對愛一無所知
'Cause I'm happy alone
因為我是快樂單身
Won't sing about, won't sing about love,
不再唱關於愛的歌
Won't sing about, don't know nothin' about love
不再唱關於愛的歌 對愛一無所知
Won't sing about, don't know nothin' about love
不再唱關於愛的歌 對愛一無所知
So happy alone
如此快樂的單身
I'm happy alone, ooo
我是快樂單身 喔喔喔
I'm happy alone
我是快樂單身
Won't sing about, won't sing about love,
不再唱關於愛的歌
Won't sing about, don't know nothin' about love
不再唱關於愛的歌 對愛一無所知
Won't sing about, don't know nothin' about love
不再唱關於愛的歌 對愛一無所知
How's it gonna end, this story,
這故事要如何收場
It really doesn't matter where it goes,
故事怎麼發展真的不怎麼重要
How more can I take it before I blow, explode, oh
在我生氣爆發之前我還能承受多少 喔
Looks like the stars keep falling
看起來像是持續墜落的星群
And the mountains they're so big today
今天的山嶽是如此巨大
The demons remain I know
我知道魔鬼依舊仍在
This is not a song about love,
這不是首關於愛的歌
'Cause I'm happy alone
因為我是快樂單身
'Cause I'm happy alone, yeah
因為我是快樂單身 耶
How happy alone
多麼快樂的單身
How happy alone
多麼快樂的單身
Won't sing about, won't sing about love,
不再唱關於愛的歌
Won't sing about, don't know nothin' about love
不再唱關於愛的歌 對愛一無所知
Won't sing about, don't know nothin' about love
不再唱關於愛的歌 對愛一無所知
I no longer fear the pain
我不再懼怕痛苦
Control's taken right out my head
不再想著掌控什麼
Just listen to the words
就聆聽這些字句
This is not about love
這不是關於愛
No nothing round here ever changes
這裡什麼也沒有改變
I'm still on my own in the world
我仍然獨自在這世上
I can't sing about love
我不會唱頌愛情
This is not a song about love,
這不是首關於愛的歌
'Cause I'm happy alone
因為我是快樂單身
Won't sing about, won't sing about love,
不再唱關於愛的歌
Won't sing about, don't know nothin' about love
不再唱關於愛的歌 對愛一無所知
Won't sing about, don't know nothin' about love
不再唱關於愛的歌 對愛一無所知
'Cause I'm happy alone
因為我是快樂單身

2018年7月29日 星期日

Estelle - American Boy(美國男孩)


輕快俏皮的一首說唱歌
一搭一唱還蠻驚人的

"American Boy"(美國男孩)

Just a number one champion sound
正是場一流賽事的聲音響起
Yeah, Estelle, we 'bout to get down, get down.
耶,艾絲黛,我們來尬舞吧,舞動起來
Who the hottest in the world right now.
看誰才是現今世上最辣的人
Just touched down in London town.
正好降落在倫敦城
Bet they give me a pound.
打賭他們給我一英鎊
Tell them put the money in my hand right now.
告訴他們直接把錢放在我手裡
Yes
是滴
Tell the promoter we need more seats,
告訴承辦商多準備需座位
We just sold out all the floor seats
我們剛賣完了所有的前排座票

Take me on a trip, I'd like to go some day.
帶我去旅行,總有一天我會啟程出發
Take me to New York, I'd love to see LA.
帶我去紐約,我想去見識洛杉磯
I really want to come kick it with you.
我真的很想和你一起去放鬆一下
You'll be my American boy.
你將是我的美國男孩

He said "Hey, Sister.
他說:“嗨,姐姐
It's really, really nice to meet ya."
真的真的很高興認識妳
I just met this 5 foot 7 guy who's just my type.
我剛認識這五尺七的傢伙,他正是我的菜啊
I like the way he's speaking, his confidence is peaking.
我喜歡他說話的方式,他那自信爆棚到不能再高了!
Don't like his baggy jeans but I'mma like what's underneath them.
不喜歡他寬鬆的牛仔褲但我會喜歡藏在衣著下的東西(羞~)
And no I ain't been to MIA
不,我沒去過邁阿密

I heard that Cali never rains and New York's heart awaits.
聽說加州從不下雨,紐約正期待我的到來
First let's see the west end.
讓我們先去西部看看
I'll show you to my brethren.
我會帶你讓我的弟兄們瞧瞧
I'm liking this American boy, American boy
我正喜歡著這美國男孩,美國男孩

Take me on a trip, I'd like to go some day
帶我去旅行,總有一天我會啟程出發
Take me to New York, I'd love to see LA.
帶我去紐約,我想去見識洛杉磯
I really want to come kick it with you.
我真的很想和你一起去放鬆一下
You'll be my American boy, American boy
你將是我的美國男孩,美國男孩

Can we get away this weekend?
這週末我們可以去度個假走走嗎?
Take me to Broadway.
帶我去百老匯
Let's go shopping, baby, then we'll go to a café.
寶貝,我們去購物,然後再去喝個咖啡
Let's go on the subway.
接著去搭地鐵
Take me to your hood.
帶我去你的地盤
I never been to Brooklyn and I'd like to see what's good.
我從未去過布魯克林,我想去看看有什麼好的
Dress in all your fancy clothes.
穿上你所有花俏的衣服
Sneakers looking fresh to death, I'm loving those Shell Toes.
運動鞋看起來潮的要死,我就喜歡那些貝殼鞋頭(愛迪達的那三條槓)
Walking that walk.
走自己的路
Talk that slick talk.
說些浮誇的話
I'm liking this American boy, American boy.
我正喜歡著這美國男孩,美國男孩

Take me on a trip, I'd like to go some day
帶我去旅行,總有一天我會啟程出發
Take me to New York, I'd love to see LA.
帶我去紐約,我想去見識洛杉磯
I really want to come kick it with you.
我真的很想和你一起去放鬆一下
You'll be my American boy
你將是我的美國男孩

Tell 'em wagwan blud
告訴他們有什麼新鮮事

Who killing 'em in the UK.
誰會在英國幹掉他們
Everybody gonna say, "You, K."
每個人都會說是你,K
Reluctantly 'cause most of this press don't fuck with me.
很不情願,因為大部分的報刊與論根本不鳥我
Estelle once said to me, "Cool down, down, don't act a fool now, now."
艾絲黛曾對我說,冷靜、冷靜,現在不要表現的像個傻瓜
I always act a fool oww oww.
我總是表現得很愚蠢
Ain't nothing new now now.
現在也不是什麼新鮮事了
He crazy, I know what ya thinking.
他瘋了,我知道你在想什麼
Ribena I know what you're drinking.
利賓納我知道你在喝什麼
Rap singer. Chain blinger.
說唱歌手 Chain blinger
Holla at the next chick soon as you're blinking.
一眨眼的時間就搭上隔壁的小妞
What's your persona.
你是什麼樣的角色
About this Americana rhymer.
關於這個美國詩人
Am I shallow 'cause all my clothes designer.
我膚淺嗎?就因為我所有的服裝設計師
Dressed smart like a London Bloke.
穿得像倫敦的小伙子一樣時髦
Before he speak his suit bespoke.
在說出他的定制西服之前
And you thought he was cute before.
你認為他以前很可愛
Look at this peacoat, tell me he's broke.
看看這個海軍大衣,告訴我他身無分文
And I know you ain't into all that.
而且我知道你還沒到這樣的情況
I heard your lyrics I feel your spirit.
我聽了你的歌詞 我感受到你的精神
But I still talk that CASH.
但我仍然談論錢
'Cause a lot wags wanna hear it.
因為很多大嫂團想要聽
And I'm feeling like Mike at his Baddest.
而我覺得自己就像是 邁克在他最棒的時期
Like The Pips at their Gladys.
就像葛蘭迪絲奈與種子合唱團
And I know they love it.
我知道他們喜歡它
So to hell with all that rubbish
我根本不在意那些垃圾

Would you be my love, my love?
你願意成為我的愛人?
Could you be mine?
你能是屬於我的嗎?
Would you be my love, my love?
你願意成為我的愛人?
Could you be mine?
你能是屬於我的嗎?
Could you be my love, my love?
你願意成為我的愛人?
Would you be my American boy, American boy?
你願意是我的美國男孩嗎?
Take me on a trip, I'd like to go some day
帶我去旅行,總有一天我會啟程出發
Take me to Chicago, San Francisco Bay.
帶我去芝加哥、舊金山灣
I really want to come kick it with you.
我真的很想和你一起去放鬆一下
You'll be my American boy, American boy
你將是我的美國男孩,美國男孩
You'll be my American boy.
你將是我的美國男孩
Be my American boy!
成為我的美國男孩
American boy.
美國男孩

La la lala la lalala
拉...
La la lala la lalala
拉...


2018年5月23日 星期三

How to write about Taiwan

這篇參考了 HOW TO WRITE ABOUT AFRICA  (Binyavanga Wainaina) 
不過原文其實是一篇反諷的文章 
指出世人對非洲固有的刻板印象
在寫這篇How to write about Taiwan時
好像寫不太出反諷的感覺
反而有點像在練習寫實文~
How to write about Taiwan
Always use the word ‘Guidao’ or ‘Ghost’ in your title. For example, Guidao-Taiwin or Ghost Island Taiwan. Some important keywords such as ‘22k’,’low salaries’, ’high prices ’,’corrupt officials’, ‘media mess’, ’strawberry-like generation’ or ‘sweat labor’ should appear in your text. Note that there are only two cities in Taiwan, Taipei and non-Taipei and the region not in the Capital of Taiwan belongs to countryside or rural areas.
Never say Taiwan is a country or an ‘independent’ country. In your text, treat Taiwan as if it were part of China. At least call it Chinese Taipei. Otherwise, Xi Jinping, China’s leader will be very unhappy. If you still don’t know how to name Taiwan, then ‘Ghost Island’ is preferred because you can’t escape from.
Avoided subject: delicious foods (stinky tofu is an exception), Taipei 101, convenience stores (unless a blood and sweat employee is involved), mention of government officials who are honest and free from corruption.
       Among your characters you must always include two kinds of Taiwanese people. One is who live in Taipei also know as ‘Sky Dragon country’. He must be from a noble family or he is the rich second generation. Try to describe how much better or superior he is. Also make sure that he likes waiting in line. The other is non-Taipei citizen who works hard for his life. Say much more about his hard work and how long his working hours is. But remember, 22k is the only number he can receive.

      Always end your article with strange things that happened in ‘Ghost Island’. Because you can’t escape from.

              

2018年4月13日 星期五

Carlos Rivera - Recuérdame(勿忘我)

Carlos Rivera - Recuérdame

皮卡斯電影動畫 <可可夜總會>的主題曲
一開始以為是電影中偶像歌手的成名曲
希望他自己不被世人所遺忘而唱的一首歌
但這首歌的真相並不是要寫給全世界
其實是要表達一位父親對女兒的愛

Recuérdame, hoy me tengo que ir, mi amor
勿忘我    即使今日我將離去, 親愛的
Recuérdame, no llores, por favor
勿忘我          請別哭泣  
Te llevo en mi corazón y cerca me tendrás
我把你帶進心裡       而你我是緊緊靠近
A solas yo te cantaré soñando en regresar
我將獨自為你歌唱   夢想著返回的時候
Recuérdame, aunque tenga que emigrar
勿忘我       即便我必須遠走他鄉
Recuérdame, si mi guitarra oyes llorar
勿忘我      如果妳聽到我如泣的吉他聲
Ella con su triste canto te acompañará,
用憂傷的歌唱陪伴著你
hasta que en mis brazos tú estés
直到你回到我懷抱
Recuérdame...
勿忘我
Recuérdame, hoy me tengo que ir, mi amor
勿忘我    即使今日我將離去, 親愛的
Recuérdame, no llores, por favor
勿忘我          請別哭泣  
Te llevo en mi corazón y cerca me tendrás
我把你帶進心裡       而你我是緊緊靠近
A solas yo te cantaré soñando en regresar
我將獨自為你歌唱   夢想著返回的時候
Recuérdame, aunque tenga que emigrar
勿忘我       即便我必須遠走他鄉
Recuérdame, si mi guitarra oyes llorar
勿忘我      如果妳聽到我如泣的吉他聲
Ella con su triste canto te acompañará,
用憂傷的歌唱陪伴著你
hasta que en mis brazos tú estés
直到你回到我懷抱
Recuérdame
勿忘我