2018年5月16日 星期三

Leetcode - 657. Judge Route Circle

Question:
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.


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日 星期二

Vim - 移動游標

  • gg ( = 1G )  -  跳到檔案第一行
  • G  -  跳到檔案最後一行
  • :5 ( = 5G )  -  跳到第5行

2018年2月13日 星期二

2018年1月26日 星期五

Git - 常用指令 : git add, git commit, git push, git status, git log, git show

  • git add
    • 將選擇的檔案先加入到 staging area
      • git add test_file.c
      • git add ../../test_file.h
        • 說明 : 不一定只能加入同一層的檔案