Skip to content
Closed
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
02658f5
Create 593. Valid Square
jyoung2419 Oct 10, 2026
fa32bc8
593
rimgosu Oct 10, 2026
da248fe
2350
h2s0 Oct 11, 2026
c595034
Create 2350. Shortest Impossible Sequence of Rolls
jyoung2419 Oct 11, 2026
0eb3539
Create 2350. Shortest Impossible Sequence of Rolls.py
724thomas Oct 11, 2026
a3b932b
2350
rimgosu Oct 11, 2026
035bf86
Create 4056. Number of Intersecting Interval Pairs I.java
cyzlcyzl Oct 12, 2026
734f97d
Create 4056. Number of Intersecting Interval Pairs I
jyoung2419 Oct 12, 2026
f725ec4
4056
rimgosu Oct 12, 2026
a5c1fc4
Create 4056. Number of Intersecting Interval Pairs I.py
724thomas Oct 11, 2026
2245af7
4061
h2s0 Oct 13, 2026
4fe9879
Implement minQueenMoves function for queen moves
jyoung2419 Oct 13, 2026
6266779
Add carPooling function for trip capacity validation
jyoung2419 Oct 13, 2026
bacd835
Update 1094. Car Pooling
jyoung2419 Oct 13, 2026
661ddbe
Create 4061. Minimum Queen Moves to Reach Target.java
cyzlcyzl Oct 13, 2026
ad86a2f
Create 1094. Car Pooling.java
cyzlcyzl Oct 13, 2026
73967a7
1094,4061
rimgosu Oct 13, 2026
99af5df
Rename leetcode3/4056. Number of Intersecting Interval Pairs I.py to …
724thomas Oct 13, 2026
71ffd3f
Create 1094. Car Pooling.py
724thomas Oct 13, 2026
d0f7cf8
Create 4061. Minimum Queen Moves to Reach Target.py
724thomas Oct 13, 2026
cc44b2b
4065
h2s0 Oct 14, 2026
eb14db6
Create 4065. Rearrange Array by Removing Distinct Values.java
cyzlcyzl Oct 14, 2026
6bb9d8e
Create 4065. Rearrange Array by Removing Distinct Values
jyoung2419 Oct 14, 2026
71318cf
4065
rimgosu Oct 14, 2026
c110969
Create 4065. Rearrange Array by Removing Distinct Values.py
724thomas Oct 14, 2026
14b391d
Create 2239. Find Closest Number to Zero
jyoung2419 Oct 15, 2026
22d9809
Create 1124. Longest Well-Performing Interval
jyoung2419 Oct 15, 2026
e9cef92
2239
h2s0 Oct 15, 2026
0b77c0a
Create 2239. Find Closest Number to Zero.java
cyzlcyzl Oct 15, 2026
8c5a2ac
Create 2239. Find Closest Number to Zero.py
724thomas Oct 15, 2026
6c17209
Create 1124. Longest Well-Performing Interval.py
724thomas Oct 15, 2026
b5882cd
1124,239
rimgosu Oct 15, 2026
401f7ca
4070. Minimum Rotations to Dial a Number I
SinnoLn Oct 16, 2026
26e66c1
chore: sync main
SinnoLn Oct 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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<s.length(); i++) {
int num = s.charAt(i)-'0';

// 회전해서 갈 경우
// 바로 갈 경우

int cal = Math.abs(num-pos);

ans+=Math.min(cal, 10-cal);

pos = num;
}

return ans;
}
}
Loading