Skip to content

Instantly share code, notes, and snippets.

👓

Berkay Kaya berkayk

👓
Block or report user

Report or block berkayk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@berkayk
berkayk / Mysql invalid default value error.
Created Nov 27, 2017
This query fixes current session's invalid default value error.
View Mysql invalid default value error.
SET SESSION sql_mode= 'ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
@berkayk
berkayk / 0_reuse_code.js
Created Jul 26, 2017
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View Problem3-2-extend-stack.java
public class StackWithMin extends Stack<Integer> {
Stack<Integer> minStack;
private int minValue;
public StackWithMin() {
super();
minStack = new Stack<Integer>();
}
View Problem3-2.java
public class Node {
public Node next;
public Node nextMinimum;
public int data;
public Node(int value) {
this.data = value;
}
}
View Problem2-7.java
class Node {
Node next;
Node prev;
int data;
public Node(int value) {
this.data = value;
}
}
View Problem2-4.java
public void partitionList(Node head, int value) {
Node small = null;
Node smallItr = null;
Node great = null;
Node greatItr;
while (head != null) {
if (head.data < value) {
if (smallItr == null) {
small = smallItr = head;
}
View Problem1-7.java
public void fillZeros(int[][] matrix) {
int numRows = matrix.length;
int numCols = matrix[0].length;
boolean[] rows = new boolean[numRows];
boolean[] cols = new boolean[numCols];
for (int i = 0; i < numRows; i++) {
for (int j = 0; j < numCols; j++) {
if (matrix[i][j] == 0) {
View Problem2-2.java
public Node findLastKth(Node head, int k) {
// Assume k > 0
if (k <= 0 || head == null)
return null;
Node current = head;
Node runner = current;
while (k > 0 && runner != null) {
k--;
runner = runner.next;
View Problem2-1-with-buffer.java
class Node {
Node next = null;
char data;
public Node(char c) {
data = c;
}
}
// FOLLOW UP -> FOLW UP
View Problem1-3.java
public boolean isPermutation(String source, String dest) {
// is source a permutation of dest?
if (source == null || dest == null)
return false;
if (source.length() != dest.length()
return false;
while (source.length() > 0) {
// If they somehow
You can’t perform that action at this time.