發表文章

日文學習_五十音(清音、濁音/半濁音)絕招(看到就會讀的聯想法)筆記整理

圖片
平假名( ひら が な )  hiragana  和   片假名( かたかな )  katakana (源於外來語、英文詞) ( 清 音 部 分 ) ->  讀音時小嘴型短促音 單字舉例中會出現 濁音(特徵是右上角有兩點就是所謂的「濁音」) 半濁音(特徵是右上角有一個空心圓圈 就是所謂的「半濁音」 ) 濁音、半濁音都是從清音轉過來的 其 中濁音轉字清音當中四個行 主要是  :  か( ka)    さ( sa)     た ( ta)   は( ha)  行 諧音  --->    凱       薩           她          哈 (凱薩 是 她哈 的類型) 半濁音則只有  は( ha)  行 半濁音 h發音-->p發音 所以就是 HP 印表機 あ      い    う   え  お a            i              u           e            o ア  イ   ウ   エ   オ あ    ア  (a)  平假名寫法: 一個十字架 底下再配一個 の  (名詞 の 名詞 ;  .... 的(之) ....) 有點像女生的 女   看到女生發出   ...

LeetCode第7題_Reverse Integer

圖片
Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output: 321 Example 2: Input: -123 Output: -321 Example 3: Input: 120 Output: 21 Note: Assume we are dealing with an environment which could only store integers within the 32-bit signed integer range: [−2 31 ,  2 31  − 1]. For the purpose of this problem, assume that your function returns 0 when the reversed integer overflows. 思路:先嘗試取到各個字的digit,在反序去進行打印 改寫為題目對應的函式 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 public static int reverse ( int x){ ArrayList revRes = new ArrayList(); int src = x; if (x< 0 ){ x = x*(- 1 ); } while (x> 0 ){ int digit = x% 10 ; revRes. add (digit); x/= 10 ; } int res = Integer. parseInt (revRes. toString (). replace ( "[" , "" ). replace ( "]" , "" ). replace ( ", " , ...

LeetCode第633題_Sum of Square Numbers

圖片
Given a non-negative integer  c , your task is to decide whether there're two integers  a  and  b  such that a 2  + b 2  = c. Example 1: Input: 5 Output: True Explanation: 1 * 1 + 2 * 2 = 5 Example 2: Input: 3 Output: False 題目就是給定一個數輸入 判定是不是某兩個數的平方和 就是如此 1 -> 0^2 + 1^2 =1 -> true 2-> 1^2 + 1^2 = 2 -> true ... 3 -> x 4-> 0^2+2^2 = 4  ->true 第一版.直觀法(暴力法) 使用兩層迴圈去跑 範圍皆從0跑到該數 利用演算法【奇數之平方和必為一可開平方數】 圖像理解(正方形的邊) 所以改寫至程式進行算法優化後 原本輸入9 我的作法是給其跑兩層迴圈 i從0到9 j從0到9 ------------------------------- i=0時 j=0,j=1,j=2.......j=9給個都去跑 . . . i=9時 j=0,j=1,j=2.......j=9 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the edito...

LeetCode第367題_Valid Perfect Square

圖片
Given a positive integer  num , write a function which returns True if  num  is a perfect square else False. Note:   Do not  use any built-in library function such as  sqrt . Example 1: Input: 16 Returns: True Example 2: Input: 14 Returns: False 注意 -2 回傳 false -1 回傳 false 0  回傳 false 1 回傳 true 2 回傳  false 4 回傳 true 16 回傳 true 然後一樣小心over flow 所以迴圈尋訪不用int 改用long 較保險 CODE 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package leetcode367_validperfectsquare; import java.io.BufferedReader ; import java.io.IOException ; import java.io.InputStreamReader ; /** * * @author chous */ public class LeetCode367_ValidPerfectSquare { /** ...