Skip to content

Instantly share code, notes, and snippets.

View BerkeSoysal's full-sized avatar
🦍
Focusing

Berke Soysal BerkeSoysal

🦍
Focusing
View GitHub Profile
class Solution {
public boolean equationsPossible(String[] equations) {
HashMap<Character, ArrayList<Character>> equalGraph = new HashMap<>();
for(String equation: equations)
{
if(equation.charAt(1)=='=')
{
Character var1 = equation.charAt(0);
Character var2 = equation.charAt(3);
import org.junit.Test;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static org.junit.Assert.assertTrue;
public class Program {
class Solution {
public int evalRPN(String[] tokens) {
Stack<Integer> stack = new Stack<>();
for(String s: tokens)
{
if(s.matches("-?\\d+"))
{
stack.push(Integer.valueOf(s));
}
else
package berke;
import java.util.*;
public class Main
{
private static Boolean found = false;
private static Double answer = -1d;
// "static void main" must be defined in a public class.
public class PasswordService
{
private PasswordHasher passwordHasher;
public PasswordService(PasswordHasher passwordHasher)
{
this.passwordHasher = passwordHasher;
}
void hashPassword(String password)
public class PasswordService
{
private Base64Hasher hasher = new Base64Hasher();
void hashPassword(String password)
{
hasher.hashPassword(password);
}
}
public abstract class Hashed
{
PasswordHasher passwordHasher;
String hash;
public void generateHash(String password)
{
hash = passwordHasher.hashPassword(password);
}
}
public class Base64 extends Hashed
{
public Base64()
{
this.passwordHasher = new Base64Hasher();
}
}
public abstract class Hashed
{
PasswordHasher passwordHasher;
String hash;
abstract void generateHash(String password);
}
public class UnHashed implements PasswordHasher
{
@Override
public String hashPassword(String password)
{
return password;
}
}