Skip to content

Instantly share code, notes, and snippets.

View chaudharisuresh997's full-sized avatar
🤓

Suresh Chaudhari chaudharisuresh997

🤓
View GitHub Profile
@chaudharisuresh997
chaudharisuresh997 / git loose object error.txt
Created February 11, 2020 08:30
Git loose oebject error
https://stackoverflow.com/questions/4254389/git-corrupt-loose-object
Your best bet is probably to simply re-clone from the remote repo (ie. Github or other). Unfortunately you will lose any unpushed commits and stashed changes, however your working copy should remain intact.
First make a backup copy of your local files. Then do this from the root of your working tree:
rm -fr .git
git init
git remote add origin [your-git-remote-url]
git fetch
@chaudharisuresh997
chaudharisuresh997 / Permutaion.java
Created December 26, 2019 10:55
Permutation is repeating list in output.
import java.util.ArrayList;
public class Solution{
public ArrayList<ArrayList<Integer>> permute(ArrayList<Integer> A) {
ArrayList<ArrayList<Integer>> big=new ArrayList<ArrayList<Integer>>();
permute(big,A,0);
return big;
}
public class Solution {
public int divide(int A, int B) {
if(A==Integer.MIN_VALUE && B<0){
return Integer.MAX_VALUE;
}else if(A==Integer.MIN_VALUE && B>0){
return Integer.MIN_VALUE;
}
if(A==Integer.MAX_VALUE){
return Integer.MAX_VALUE;
}
@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++;
@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;
/**
* Definition for binary tree
* class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode(int x) {
* val = x;
* left=null;
* right=null;
package main
import (
"fmt"
"encoding/json"
)
type ProjectAttributes struct{
ProjectId string
Attributes map[string]map[string]string
//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"
"sync"
)
//Workgroup example
func tie(wg *sync.WaitGroup) {
fmt.Println("Shiv")
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);