Skip to content

Instantly share code, notes, and snippets.

View rajeakshay's full-sized avatar

Akshay Raje rajeakshay

View GitHub Profile
@rajeakshay
rajeakshay / InsertInterval.java
Created September 18, 2016 12:06
LeetCode 57. Insert Interval - (Problem Link - https://leetcode.com/problems/insert-interval/) Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that the intervals were initially sorted according to their start times. Example 1: Given intervals [1,3],[6,9], insert and merge [2…
/**
LeetCode 57. Insert Interval
Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).
You may assume that the intervals were initially sorted according to their start times.
Example 1:
Given intervals [1,3],[6,9], insert and merge [2,5] in as [1,5],[6,9].
Example 2:
Given [1,2],[3,5],[6,7],[8,10],[12,16], insert and merge [4,9] in as [1,2],[3,10],[12,16].
@rajeakshay
rajeakshay / AllOutcomesOfAnExpression.java
Last active September 10, 2024 08:19
Find all possible outcomes of a given expression - Given an arithmetic expression, find all possible outcomes of this expression. Different outcomes are evaluated by putting brackets at different places. There will be no spaces in the input. Only operators '+','-', and '*' are allowed. Numbers can have multiple digits. Example: Input: 1+3*2 Outp…
/**
* Find all possible outcomes of a given expression (http://www.geeksforgeeks.org/find-all-possible-outcomes-of-a-given-expression/)
* ================================================
* Given an arithmetic expression, find all possible outcomes of this expression. Different outcomes are evaluated by
* putting brackets at different places.
* NOTES:
* 1. There will be no spaces in the input.
* 2. Only operators '+','-', and '*' are allowed.
* 3. Numbers can have multiple digits.
*
@rajeakshay
rajeakshay / AllPathsFromASource.java
Created September 23, 2016 05:03
Print all paths from a given source to a destination - (http://www.geeksforgeeks.org/find-paths-given-source-destination/) Given a directed graph, a source vertex ‘s’ and a destination vertex ‘d’, print all paths from given ‘s’ to ‘d’.
/**
* Print all paths from a given source to a destination - (http://www.geeksforgeeks.org/find-paths-given-source-destination/)
* Given a directed graph, a source vertex ‘s’ and a destination vertex ‘d’, print all paths from given ‘s’ to ‘d’.
* */
import java.util.*;
public class AllPathsFromASource {
static class Graph{
int V;
Map<Integer, List<Integer>> adj; // Adjacency list
@rajeakshay
rajeakshay / PrintConflictingIntervals.java
Created September 23, 2016 05:27
In a calendar where multiple events can be scheduled over the same time window, print a list of all conflicting time windows along with the event IDs that are conflicting.
/**
* In a calendar where multiple events can be scheduled over the same time window, print a list of all
* conflicting time windows along with the event IDs that are conflicting. All times are in 24 hour format.
* Example:
* Input:
* Event 1 : 2014-01-01 9:45 - 2014-01-01 10:30
* Event 2 : 2014-01-01 10:00 - 2014-01-01 10:30
* Event 3 : 2014-01-01 10:20 - 2014-01-01 10:45
*
* Output:
@rajeakshay
rajeakshay / rust-book.md
Last active May 29, 2023 18:13
Notes from 'The Rust Programming Language' at https://rust-book.cs.brown.edu/

DISCLAIMER: These notes from 'The Rust Programming Language' book are my own and meant for my personal reference. They are not endorsed by the Rust Foundation. Visit https://www.rust-lang.org/ for the official material for learning Rust.

Installing Rust

  1. Install Rust from https://rustup.rs/.
  2. Check installation with -
    rustc --version
    
    OR
@rajeakshay
rajeakshay / vscode-neovim.md
Last active August 24, 2025 22:35
VSCode + NeoVim Quick Reference

VSCode + NeoVim

DISCLAIMER:
These are my notes for quick reference and not meant to be an exhaustive VSCode + NeoVim cheatsheet. Refer to VSCode, NeoVim and vscode-neovim documentation for the latest details.

Quick Setup

  1. Install NeoVim 0.10.0+ and VSCode.
  2. Install vscode-neovim plugin in VSCode.
  3. Add the following to NeoVim's init.lua -
    -- Bootstrap lazy.nvim