This file contains hidden or 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.Deque; | |
import java.util.HashMap; | |
import java.util.LinkedList; | |
import java.util.Objects; | |
public class Groups{ | |
static class Group { | |
final Character close; | |
final Character open; |
This file contains hidden or 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
package com.company; | |
class RowSumOddNumbers { | |
public static int rowSumOddNumbers(int n) { | |
return sum(lastElement(n)) - sum(lastElement(n - 1)); | |
} | |
private static int lastElement(int n) { | |
return ((n * n) + (n - 1)); | |
} |
This file contains hidden or 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
package com.company; | |
import java.util.Arrays; | |
import java.util.function.IntPredicate; | |
public class FindOutlier{ | |
enum Filter { | |
EVEN((i) -> mod(i) == 0), ODD((i) -> mod(i) > 0); | |
IntPredicate validator; |
This file contains hidden or 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
package com.company; | |
import java.util.ArrayList; | |
import java.util.LinkedHashMap; | |
import java.util.List; | |
import java.util.Map; | |
public class DeleteNth { | |
public static int[] deleteNth(int[] elements, int maxOccurrences) { |
This file contains hidden or 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.Random; | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; | |
/** com um array e wai e notify */ | |
public class ProducerConsumer { | |
static class Producer implements Runnable { | |
private int[] items; |