Sandbox

  • 홈
  • 태그
  • 방명록

java 2

[HackerRank] Jumping on the Clouds _Java8

Problem Solution Max distance that we can move at a time is 2. Look at the index value larger than current position by 2. If the value is 0, move 2 times and add a jump. If the value is 1, move just one time and add a jump. (If we are at a position where only one number is left in the array, it is not possible to move up 2 times... so just add one jump and end the loop.) import java.io.*; import..

CODE/Algorithms & Data Structures 2021.08.06

[HackerRank] Counting Valleys _Java8

Problem Need two integers: one for keeping track of the number of valleys, and another for tracking current position. Let the hiker start at position 0. "U" represents +1, "D" represents -1. Since we only care about the number of valleys completed and not mountains, we want to know when the hiker climbs out of a valley... which would be the moment position -1 becomes 0. import java.io.*; import ..

CODE/Algorithms & Data Structures 2021.08.06
이전
1
다음
더보기
프로필사진

Sandbox

  • 분류 전체보기 (48)
    • CODE (2)
      • Algorithms & Data Structure.. (43)
      • React (0)
    • READ (3)

Tag

level order traversal, Binary Tree, array, Binary Search, hackerrank, string, Merge Sort, LinkedList, Linked List, inorder traversal, LeetCode, algorithm, python3, Coderust, depth first search, java, binary search tree, preorder traversal, dynamic programming, Implementation,

최근글과 인기글

  • 최근글
  • 인기글

최근댓글

공지사항

페이스북 트위터 플러그인

  • Facebook
  • Twitter

Archives

Calendar

«   2025/07   »
일 월 화 수 목 금 토
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

방문자수Total

  • Today :
  • Yesterday :

Copyright © Kakao Corp. All rights reserved.

티스토리툴바