기록하는 공간

  • 홈
  • 태그
  • 미디어로그
  • 위치로그
  • 방명록

java 2

[leetcode/java] 1427.Perform String Shifts

substring 함수를 이용한 풀이 class Solution { private String takeOrtakeLast(int direction, int amount, String s) { int strLength = s.length(); if (direction == 0) { s = s.substring(amount, strLength) + s.substring(0 , amount); } else { s = (s.substring(strLength - amount, strLength) + s).substring(0, strLength); } return s; } public String stringShift(String s, int[][] shift) { for (int i = 0; i < shift..

알고리즘/Leetcode 2020.04.15

[leetcode/java] 287. Find the Duplicate Number

Map을 이용한 풀이 class Solution { public int findDuplicate(int[] nums) { int duplicateNumber = 0; int numsLength = nums.length; Map map = new HashMap(); for (int i : nums) { map.put(i, map.getOrDefault(i, 0) + 1); if (map.get(i) > 1) duplicateNumber = i; } return duplicateNumber; } }

알고리즘/Leetcode 2020.04.11
이전
1
다음
더보기
프로필사진

기록하는 공간

  • 분류 전체보기 (38)
    • 알고리즘 (34)
      • Leetcode (29)
      • Codility (5)
    • 프로그래밍 (0)
      • Spring (0)
      • Kotlin (0)
    • 도서 (1)
      • Clean Code (1)
    • 맛집 (3)

Tag

맛집, 코테, 른당사피, java, prefix sum, algorithum, LeetCode, linked list, map, two pointers, algorithm, string, 망원 밥집, 알고리즘, 코딩 테세트, 투포인터, tree, 코딩 테스트, Array, Python,

최근글과 인기글

  • 최근글
  • 인기글

최근댓글

공지사항

페이스북 트위터 플러그인

  • Facebook
  • Twitter

Archives

Calendar

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

티스토리툴바