diff --git "a/leetcode3/\354\235\264\354\247\204\355\235\254/4070. Minimum Rotations to Dial a Number I.java" "b/leetcode3/\354\235\264\354\247\204\355\235\254/4070. Minimum Rotations to Dial a Number I.java" new file mode 100644 index 00000000..f362fdc5 --- /dev/null +++ "b/leetcode3/\354\235\264\354\247\204\355\235\254/4070. Minimum Rotations to Dial a Number I.java" @@ -0,0 +1,36 @@ +/* + +1. 아이디어 : 다이얼 크기 10 -> 시계방향, 반시계방향 회전의 경우중 더 짧은것 선택 + + 경우의 수 (a->b) + 1. |a-b| + 2. 9 - |a-b| + +2. 시간복잡도 : O(s 문자열 길이) + +3. 자료구조/알고리즘 : 그리디 + + */ + +class Solution { + public int minRotations(String s) { + + int ans = 0; + int pos = 0; + + for(int i=0; i