Initially, there is a Robot at position (0, 0). Given a sequence of its moves, judge if this robot makes a circle, which means it moves back to the original place. The move sequence is represented by a string. And each move is represent by a character. The valid robot moves are R (Right), L (Left), U (Up) and D (down). The output should be true or false representing whether the robot makes a circle.
2018年5月16日 星期三
Leetcode - 657. Judge Route Circle
Question:
Leetcode - 520. Detect Capital
Question
Given a word, you need to judge whether the usage of capitals in it is right or not. We define the usage of capitals in a word to be right when one of the following cases holds: 1. All letters in this word are capitals, like "USA". 2. All letters in this word are not capitals, like "leetcode". 3. Only the first letter in this word is capital if it has more than one letter, like "Google". Otherwise, we define that this word doesn't use capitals in a right way.
Leetcode - 1. Two Sum
Question:
Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice.
Leetcode - 283. Move Zeroes
Question:
Given an array nums, write a function to move all 0's to the end of it
while maintaining the relative order of the non-zero elements.
2018年3月13日 星期二
2018年2月13日 星期二
[C] error : static declaration follows non-static declaration (2)
error message
error: static declaration of 'set_radio' follows non-static declaration
set_radio(radio_cfg_db radio)
^
2018年1月24日 星期三
Git - error : Your local changes to the following files would be overwritten by merge
- error message
error: Your local changes to the following files would be overwritten by merge:
project/code.c
Please, commit your changes or stash them before you can merge.
Aborting
================================================================
================================================================
- explain
- git pull 後如果出現上面的error 訊息,
表示 local 端的 code.c 的跟 remote 端的程式有衝突,
也就是說已經有人跟你一樣改到 code.c 的同一段程式,
而且比你早把程式放到 server 上
2018年1月10日 星期三
Linux - 管理 patch 的工具 : quilt
- 1. 使用 quilt
- 需要在其他開發者的 source code 增加程式碼 (例 : linux kernel, hostapd ...)
因爲無法直接使用 git 的方式 push code,
所以使用 patch 的方式增加需要修改的 code,
而 quilt 就是管理和產生 patch 的工具 - quilt 的操作跟 stack 一樣,
quilt push -> 把一個 patch 的內容放到 source code
quilt pop -> 讓 source code 的內容回復還沒有上一個 patch 的狀態 - 2. 安裝 quilt
- sudo apt-get install quilt
訂閱:
文章 (Atom)