This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Map; | |
import java.util.HashMap; | |
class Solution { | |
public int solution(String[] want, int[] number, String[] discount) { | |
int answer = 0; | |
Map<String, Integer> wantMap = new HashMap<>(); | |
Map<String, Integer> discountMap = new HashMap<>(); | |
for(int i=0; i<want.length; i++){ | |
wantMap.put(want[i], number[i]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
class Solution { | |
public int solution(int[] cards) { | |
List<Integer> result = new ArrayList<>(); | |
boolean[] visited = new boolean[cards.length]; | |
for(int i=0; i<cards.length; i++){ | |
int cnt = 0; | |
if(!visited[i]){ | |
int start = cards[i]; | |
int end = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Stack; | |
class Solution { | |
public int solution(int[] order) { | |
int answer = 0; | |
Stack<Integer> conveyor = new Stack<>(); | |
for(int i=1; i<=order.length; i++){ | |
conveyor.push(i); | |
while(!conveyor.isEmpty()){ | |
if(conveyor.peek() == order[answer]){ | |
answer++; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
class Solution { | |
public int solution(int k, int[] tangerine) { | |
int answer = 0; | |
Map<Integer, Integer> map = new HashMap<>(); | |
for(int size:tangerine){ | |
map.put(size, map.getOrDefault(size, 0) + 1); | |
} | |
List<Integer> temp = new ArrayList<>(map.values()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.util.StringTokenizer; | |
public class Main { | |
public static void main(String[] args) throws IOException { | |
BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); | |
StringTokenizer st = new StringTokenizer(br.readLine()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Main { | |
public static void main(String[] args) { | |
Scanner sc = new Scanner(System.in); | |
String[] input = sc.nextLine().split(" "); | |
if(input[0].length() != input[1].length()) System.out.println(0); | |
else { | |
int cnt = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.util.StringTokenizer; | |
public class Main { | |
public static void main(String[] args) throws IOException { | |
BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); | |
StringTokenizer st = new StringTokenizer(br.readLine()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
🌞 Morning 26 commits ███▍░░░░░░░░░░░░░░░░░ 16.6% | |
🌆 Daytime 39 commits █████▏░░░░░░░░░░░░░░░ 24.8% | |
🌃 Evening 65 commits ████████▋░░░░░░░░░░░░ 41.4% | |
🌙 Night 27 commits ███▌░░░░░░░░░░░░░░░░░ 17.2% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution { | |
public int solution(String s) { | |
int answer = s.length(); | |
StringBuffer sb = new StringBuffer(); | |
for(int i=1; i<=s.length()/2; i++){ | |
int count = 1; | |
String repeat = s.substring(0, i); | |
for(int j=i; j<=s.length(); j += i){ | |
String curStr = j+i > s.length() ? s.substring(j, s.length()) : s.substring(j, j+i); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.util.Arrays; | |
import java.util.StringTokenizer; | |
public class Main { | |
public static void main(String[] args) throws IOException { | |
BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); | |
StringTokenizer st = new StringTokenizer(br.readLine()); |
NewerOlder