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 leetcode.laststone; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.Collections; | |
import java.util.List; | |
import java.util.stream.Collectors; | |
/** | |
* We have a collection of stones, each stone has a positive integer weight. |
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
/** | |
* Definition for a binary tree node. | |
* public class TreeNode { | |
* int val; | |
* TreeNode left; | |
* TreeNode right; | |
* TreeNode(int x) { val = x; } | |
* } | |
*/ |
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
/** | |
* Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. | |
* Your MinStack object will be instantiated and called as such: | |
* | |
* > MinStack obj = new MinStack(); | |
* > obj.push(x); | |
* > obj.pop(); | |
* > int param_3 = obj.top(); | |
* > int param_4 = obj.getMin(); |
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.*; | |
class BackspaceStringCompareWithStack { | |
/** | |
* @param S lower case letters with backspace # E.g. ab## | |
* @param T lower case chars with backspace # E.g. #a#c | |
* | |
* @return S contentEquals T | |
*/ |
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
class BackspaceStringCompareInterpreter { | |
/** | |
* Given two strings S and T, return if they are equal when both are typed into empty text editors. | |
* | |
* Performance: O(n) time, O(n) space | |
* | |
* @param S lower case letters with backspace # E.g. ab## | |
* @param T lower case chars with backspace # E.g. #a#c |
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
/*-- | |
Write a function, that given a list (or array) of integers and an integer s, | |
prints all combinations of 2 numbers in the list that sum to s. | |
For the list 1, 2, 3 and sum = 4, your function could print: | |
1 + 3 = 4 | |
3 + 1 = 4 | |
*/ | |
import java.util.*; |
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 javax.crypto.Cipher; | |
import javax.crypto.spec.SecretKeySpec; | |
public class EncryptSample { | |
private static final String KEY = "AB1C11111111111AAAAAAADDDDD11111"; | |
private static final int PIN_LENGTH = 6; | |
public static void main(String[] args) throws Exception { | |
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
public class FileWriteExample { | |
public static void main(String[] args) { | |
writeToFile(".\\config\\Ogrenciler_Program.txt", "mesaj 1", "mesaj 2"); | |
} | |
private static void writeToFile(String filePath, String [] messages) throws FileNotFoundException { | |
File ciktiDosyasi = new File(); | |
PrintWriter dosyaYazici = new PrintWriter(ciktiDosyasi); | |
for (String m : messages) { | |
dosyaYazici.println(o); |
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
public class MedipolNYP2017BaharOdev2 { | |
public static void main(String[] args) { | |
int[] ogrenciSinavSonuclari = | |
{ 65, 80, 80, 20, 65, 65, 15, 80, 70 }; | |
// 101 farkli not olabilir | |
int[] notlarIstatistik = new int[101]; | |
// hesapla - | |
// Bu kismi siz yapacaksiniz |
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
/** | |
* TopCoder: SRM 625 Div2 Round 1 | |
* | |
* http://community.topcoder.com/stat?c=problem_statement&pm=13231&rd=15858&rm=322742&cr=20029384 | |
* | |
* You are given an int y. We are looking for any int[] x that satisfies the following constraints: | |
* - No x[i] can be equal to 0 or 1. | |
* - Each x[i] must be between -1000 and 1000, inclusive. | |
* - ( x[0] * x[1] ) + x[2] = y | |
* - x has exactly three elements |