This file contains hidden or 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 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; | |
} |
This file contains hidden or 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
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; | |
} |
This file contains hidden or 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
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 |
This file contains hidden or 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]interface{} | |
} |
This file contains hidden or 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
gocov test ./... | gocov-xml > coverage.xml | |
https://github.com/AlekSi/gocov-xml | |
go get github.com/axw/gocov/gocov | |
go test workspace/... --coverprofile=coverage.txt | |
gocov convert coverage.txt > coverage.json | |
gocov-xml < coverage.json > coverage.xml | |
#Go coverage | |
https://github.com/ory/go-acc |
This file contains hidden or 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
//https://www.interviewbit.com/problems/combination-sum/ | |
public class Solution { | |
public ArrayList<ArrayList<Integer>> combinationSum(ArrayList<Integer> A, int B) { | |
ArrayList<ArrayList<Integer>> big=new ArrayList<ArrayList<Integer>>(); | |
if(A.size()==0){ | |
return big; | |
} | |
Collections.sort(A); | |
combination(big,0,A,B,new ArrayList<Integer>(),B); | |
Collections.sort(big,new Comparator<ArrayList<Integer>>(){ |
This file contains hidden or 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
/* | |
take 1 2 3 4------1thousand two hundread thitry four | |
limit 10 lakh | |
*/ | |
public class NumberToWord{ | |
public String numLetters(char ch){ | |
if(ch=='1'){ | |
return "one"; |
This file contains hidden or 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
Important and Useful links from all over the Leetcode | |
Link:https://leetcode.com/discuss/general-discussion/665604/important-and-useful-links-from-all-over-the-leetcode | |
By deepika135 | |
Most of the time I want to comeback to a particular post on Leetcode and so I have to bookmark different posts a lot of times. This has led to an increase to the number of my bookmarks a lot. Since there is no option to bookmark your favourite articles on Leetcode, I have been trying to compile a list of all Leetcode's important and useful links. Here is the list I have made till now. Posting it here so as to help the LC community as well. Do let me know the useful and important articles that I have missed. Will add them to this list. This way we all won't have to bookmark many posts on Leetcode and instead just bookmark this post alone. | |
Hope this helps - | |
I am trying to compile all the good posts on Leetcode. Comment down whichever I am missing and I will add all of them here - | |
DP for beginners by @wh0ami - https://leetcode.co |
This file contains hidden or 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
#Connect to pod | |
kubectl exec --stdin --tty shell-demo-pod -- /bin/bash | |
#for alpine image | |
kubectl exec --stdin --tty shell-demo-pod -- /bin/sh | |
#PING the kubernetes service | |
>nslookup "endpoint service ip" | |
#MOngo commands | |
#switch to collection |
This file contains hidden or 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
#Sort by the fields comparator | |
student_tuples = [ | |
('john', 'A', 15), | |
('jane', 'B', 12), | |
('dave', 'B', 10), | |
] | |
sorted(student_tuples, key=lambda student: student[2]) # sort by age | |
[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)] |