Skip to content

Yeji/programmers #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 16, 2023
Merged
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
feat : 프로그래머스 greedy 실패
  • Loading branch information
cyeji committed Apr 16, 2023
commit 70961271774010366b095ec868f624a2e3f044a9
36 changes: 36 additions & 0 deletions src/main/java/sgyj/programmers/yeji/greedy/Solution42860.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package sgyj.programmers.yeji.greedy;

// 조이스틱
public class Solution42860 {
private static int answer;
private static int min = Integer.MAX_VALUE;
private static int[] visited;
// A - 65, Z - 90
public static int solution(String name) {
visited = new int[name.length()];
int startAlpha = name.charAt( 0 );

if(startAlpha<=77){
visited[0] = startAlpha+1;
answer+= startAlpha+1;
}else{
visited[0] = 90-startAlpha;
answer+= 90-startAlpha;
}
for(int i=1; i<name.length(); i++){
moveJoyStick(1,visited[i-1], name,0);
}
return answer;
}

public static void moveJoyStick(int i, int cur, String name, int count){
int result = Integer.valueOf(name.charAt( i ));
int abs = Math.abs( 90 - cur );


}
public static void main ( String[] args ) {
String name = "JEROEN";
System.out.println(solution(name));
}
}