Skip to content

Instantly share code, notes, and snippets.

View justinbaskaran's full-sized avatar
👋

Justin Baskaran justinbaskaran

👋
View GitHub Profile
@justinbaskaran
justinbaskaran / CleanUpMySpotify.py
Last active February 28, 2026 22:21
Clean Up My Spotify!
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
driver = webdriver.Chrome()
driver.get("https://open.spotify.com")
@justinbaskaran
justinbaskaran / AOC_Day2.js
Created December 3, 2022 20:40
Advent of Code Day 2
// Advent of Code Day 2
@justinbaskaran
justinbaskaran / AOC_Day1.js
Last active December 5, 2022 04:48
Advent of Code (AOC) Day 1 Solution
// Advent of Code Day 1
fs = require('fs')
fs.readFile('test1.txt', 'utf8', function (err,str) {
if (err) {
return console.log(err);
}
let lines = str.split("\n\n");
@justinbaskaran
justinbaskaran / ImplementTrie.java
Created July 28, 2022 00:02
208. Implement Trie (Prefix Tree)
class TrieNode{
boolean isEnd=false;
private TrieNode[] links = new TrieNode[26];
public boolean containsKey(Character c){
return links[c-'a'] != null;
}
@justinbaskaran
justinbaskaran / AddBinary.java
Created July 13, 2022 16:39
67. Add Binary
class Solution {
public String addBinary(String a, String b) {
if (a.length() > b.length()) {
int diff = a.length()-b.length();
for(int i=0;i<diff;i++) {
b="0"+b;
}
} else if (b.length() > a.length()) {
int diff = b.length()-a.length();
@justinbaskaran
justinbaskaran / RomantoInteger.java
Created July 13, 2022 14:38
13. Roman to Integer
class Solution {
public int romanToInt(String s) {
int result =0;
int length = s.length()-1;
int i=0;
while (i<length) {
if (getValue(s.substring(i,i+2))!= -1) {
System.out.println(s.substring(i,i+2));
System.out.println(getValue(s.substring(i,i+2)));
@justinbaskaran
justinbaskaran / BackspaceStringCompare.java
Created July 11, 2022 19:21
844. Backspace String Compare
class Solution {
public boolean backspaceCompare(String s, String t) {
Stack<Character> stackS = new Stack<Character>();
for(Character c: s.toCharArray()){
if (c.equals('#')) {
if (stackS.size()> 0) {
stackS.pop();
}
} else {
stackS.push(c);
@justinbaskaran
justinbaskaran / ContainsDuplicate.java
Created July 11, 2022 18:58
217. Contains Duplicate
class Solution {
public boolean containsDuplicate(int[] nums) {
HashSet<Integer> set = new HashSet<Integer>();
for(int i: nums){
if(set.contains(i)){
return true;
} else {
set.add(i);
}
}
@justinbaskaran
justinbaskaran / MaximumDepthofBinaryTree.java
Created July 11, 2022 15:25
104. Maximum Depth of Binary Tree
/**
* Definition for a binary tree node.
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode() {}
* TreeNode(int val) { this.val = val; }
* TreeNode(int val, TreeNode left, TreeNode right) {
* this.val = val;
@justinbaskaran
justinbaskaran / MiddleOfLinkedList.java
Created July 11, 2022 15:19
876. Middle of the Linked List
/**
* Definition for singly-linked list.
* public class ListNode {
* int val;
* ListNode next;
* ListNode() {}
* ListNode(int val) { this.val = val; }
* ListNode(int val, ListNode next) { this.val = val; this.next = next; }
* }
*/