Skip to content

Instantly share code, notes, and snippets.

621. Task Scheduler
https://leetcode.com/submissions/detail/476271316/
Solution :
public static int leastInterval2(char[] tasks, int n) {
Integer[] taskOccurence = new Integer[26];
Arrays.fill(taskOccurence, 0);
(1)URL Shortening Service like tiny URL
https://www.educative.io/courses/grokking-the-system-design-interview/m2ygV4E81AR
(2)
@ajaynitt
ajaynitt / BehaviouralInterview
Created May 17, 2020 18:03
behavioural interview educative
https://www.educative.io/courses/grokking-the-behavioral-interview/N0WMEjEQqYN
@ajaynitt
ajaynitt / volatile.java
Created December 4, 2019 08:24
volatile keyword example in java
package com.ajay.volatile_example;
public class VolatileTest {
private static volatile int MY_INT = 0;
public static void main(String[] args) {
new ChangeListener().start();
new ChangeMaker().start();
@ajaynitt
ajaynitt / hacking
Created November 10, 2019 05:39
Ethical Hacking
https://overthewire.org/wargames/maze/
@ajaynitt
ajaynitt / objectCreation.java
Created October 25, 2018 04:49
object creation - memory leavel info in java
public class MyProgram {
public static void main(String[] args) {
// Create an 'MyObject' for the first time the application started
MyObject obj = new MyObject();
}
@ajaynitt
ajaynitt / clone.cpp
Last active October 25, 2018 05:04
Cloning of objects in java - normal and faster approach
Cloning is not automatically available to classes. There is some help though, as all Java objects inherit the protected Object clone() method. This base method would allocate the memory and do the bit by bit copying of the object's states.
You may ask why we need this clone method. Can't we create a constructor, pass in the same object and do the copying variable by variable? An example would be (note that accessing the private memberVar variable of obj is legal as this is in the same class):
public class MyObject {
private int memberVar;
...
@ajaynitt
ajaynitt / mysql.txt
Created October 5, 2018 03:50
Mysql Advanced Knowledge
Oracle provides these transaction isolation levels.
Read committed
Serializable
Read Only
--------------------
https://docs.oracle.com/cd/B14117_01/server.101/b10743/consist.htm
@ajaynitt
ajaynitt / convexHull.cpp
Created September 11, 2018 07:39
erect the fence | convex hull problem
//https://leetcode.com/problems/erect-the-fence/description/
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
/**
* Created by ajaykumar.yadav on 11/09/18.
**/
@ajaynitt
ajaynitt / javascriptInterview.js
Last active September 10, 2018 17:32
javascript interview questions
(1)
What are JavaScript Data Types?
Following are the JavaScript Data types:
Number
String
Boolean
Function
Object