Java day 2

Java Subarray: Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] arr = new int[n]; for(int i=0; i<n; i++){ arr[i] = sc.nextInt(); } int numNegative = 0; for(int j=0; j<n; j++){ int temp = 0; for(int k=j; k<n; k++){ temp = temp + arr[k]; if(temp<0){ numNegative ++; } }... [Read More]

Java Collections

Overview List: 順序通りに並べて格納(中身の重複OK) Set: 順序がバラバラ(中身の重複OUT) Map: ペアで対応づけて格納 ArrayList 要素を格納する: return method meaning boolean add(~) リストの最後に要素を追加 void add(int,~) リストのint番目に要素を挿入 ~ set(int,~) リストのint番目の要素を上書き 要素を取り出す: return method meaning boolean~ get(int) int番目の要素を取り出す リストを調査する: return method meaning int size() 格納されている要素数を返す boolean isEmpty() 要素数がゼロであるか判定 boolean contains(~) 指定要素が含まれているか判定 int indexOf(~) 指定要素が何番目にあるか検索 イテレータを返す: return method meaning Iterator<~> iterator()... [Read More]

Java day

shortcut if: variable = (result)? '真' : '偽'; If the letter uppercase: Character.isUpperCase("A"); //true LinkedList: class Node { int data; Node next; } void Print(Node head) { while (head != null) { System.out.println(head.data); head = head.next; } } Basic Regex: Pattern pattern = Pattern.compile("a*b"); Matcher matcher = pattern.matcher("aaaaab"); // マッチしているのでtrue... [Read More]

Katsuya with family

Engineering Software Engineering HackerRank Spread sheet 30 Days of Code Challenges +7 Tutorials Java Data Structures Algorithms 30 Days of Code Challenges(20/30) Introduction (0/13) Arrays (0/5) Warmup (0/10) Cracking the Coding Interview(0/20) String (0/11) Linked Lists (0/16) Implementation (0/53) Days of Statistics Challenges(0/27) BigNumber (0/3) Trees(0/14) Constructive Algorithms (0/9)  ... [Read More]

Eat Kamakura Pasta with mom

Engineering Software Engineering HackerRank Spread sheet 30 Days of Code Challenges +1 Tutorials Java Data Structures Algorithms 30 Days of Code Challenges(13/30) Introduction (0/13) Arrays (0/5) Warmup (0/10) Cracking the Coding Interview(0/20) String (0/11) Linked Lists (0/16) Implementation (0/53) Days of Statistics Challenges(0/27) BigNumber (0/3) Trees(0/14) Constructive Algorithms (0/9)  ... [Read More]