Skip to content

Instantly share code, notes, and snippets.

View chaudharisuresh997's full-sized avatar
🤓

Suresh Chaudhari chaudharisuresh997

🤓
View GitHub Profile
package main
import (
"fmt"
u "model"
)
func MapDemo() {
@chaudharisuresh997
chaudharisuresh997 / BinaryTreeData.java
Last active December 26, 2019 07:01
BinaryTree create tree data
reate Binary search tree
TreeNode t8=new TreeNode(8);
TreeNode t3=new TreeNode(3);
TreeNode t1=new TreeNode(1);
TreeNode t6=new TreeNode(6);
TreeNode t10=new TreeNode(10);
TreeNode t9=new TreeNode(9);
TreeNode t14=new TreeNode(14);
//weird recursion gen permutation paranthesis
package com.internet;
import java.util.ArrayList;
import java.util.List;
public class PintAllPermutationOfParanthesis {
public static void printAllParanthesis(List<String> finalOp, int open, int close, int n){
if(close==n){
//for(String ls:finalOp) {
public class Factorial {
int sum(int n)
{
int sm=0;
if(n==1)
return 1;
System.out.println("sm"+sm+"n"+n);
sm=n+sum(n-1);
System.out.println("sm"+sm);
package main
import (
"fmt"
"sync"
)
//Workgroup example
func tie(wg *sync.WaitGroup) {
fmt.Println("Shiv")
//after = now.AddDate(2, 2, 5)
//fmt.Println("\nAdd multiple values:", after)
// time.Now().Local().Add(time.Hour*time.Duration(year) +
// time.Minute*time.Duration(month) +
// time.Second*time.Duration(day))
package main
import (
"fmt"
"encoding/json"
)
type ProjectAttributes struct{
ProjectId string
Attributes map[string]map[string]string
/**
* Definition for binary tree
* class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode(int x) {
* val = x;
* left=null;
* right=null;
@chaudharisuresh997
chaudharisuresh997 / gist:7d92e0ff72cc280d5a84946744dca523
Created November 9, 2019 05:28
recursion with stack vs array example
/**
* Definition for binary tree
* class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode(int x) {
* val = x;
* left=null;
* right=null;
@chaudharisuresh997
chaudharisuresh997 / SlidingMaximum.java
Created November 25, 2019 04:43
Sliding Window Maximum-Partially accpeted
public class SlidingMaximum {
public ArrayList<Integer> slidingMaximum(final List<Integer> A,int B){
int start=0;
ArrayList<Integer> result=new ArrayList<Integer>();
PriorityQueue<Integer> pq=new PriorityQueue<Integer>(Collections.reverseOrder());
for(int i=0;i<A.size();i++){
while((i-start)!=(B-1)){
pq.add(A.get(i));
i++;