This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
u "model" | |
) | |
func MapDemo() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"sync" | |
) | |
//Workgroup example | |
func tie(wg *sync.WaitGroup) { | |
fmt.Println("Shiv") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"encoding/json" | |
) | |
type ProjectAttributes struct{ | |
ProjectId string | |
Attributes map[string]map[string]string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Definition for binary tree | |
* class TreeNode { | |
* int val; | |
* TreeNode left; | |
* TreeNode right; | |
* TreeNode(int x) { | |
* val = x; | |
* left=null; | |
* right=null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Definition for binary tree | |
* class TreeNode { | |
* int val; | |
* TreeNode left; | |
* TreeNode right; | |
* TreeNode(int x) { | |
* val = x; | |
* left=null; | |
* right=null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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++; |
OlderNewer