For example, you want to set 40% alpha transparence to #000000
(black color), you need to add 66
like this #66000000
.
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
class Solution { | |
public: | |
vector<vector<int> > fourSum(vector<int> &num, int target) { | |
// Start typing your C/C++ solution below | |
// DO NOT write int main() function | |
vector<vector<int> > result; | |
if(num.size()<4) return result; | |
sort(num.begin(), num.end()); | |
for(int i=0; i<=num.size()-4; i++) | |
{ |
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 Solution { | |
public int minCut(String s) { | |
// Start typing your Java solution below | |
// DO NOT write main() function | |
if(s.length()==0) return 0; | |
int [] dp=new int [s.length()+1]; | |
for(int i=s.length(); i>=0; i--) | |
{ | |
dp[i]=s.length()-i; | |
} |
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 Solution { | |
public ArrayList<ArrayList<String>> partition(String s) { | |
// Start typing your Java solution below | |
// DO NOT write main() function | |
ArrayList<ArrayList<String>> list=new ArrayList<ArrayList<String>>(); | |
int length=s.length(); | |
if(length==0) return list; | |
part(s, 0, new ArrayList<String>(), list); | |
return list; | |
} |
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 Solution { | |
public void solve(char[][] board) { | |
// Start typing your Java solution below | |
// DO NOT write main() function | |
if( board==null || board.length==0 || board[0].length==0) return; | |
int m=board.length; | |
int n=board[0].length; | |
for(int i=0; i<m; i++) | |
{ | |
if(board[i][0]=='O') DFS(board, i, 0); |
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 Solution { | |
public int numDistinct(String S, String T) { | |
// Start typing your Java solution below | |
// DO NOT write main() function | |
int n=S.length(); | |
int m=T.length(); | |
if(n==0) return 0; | |
int d[][]=new int [n][m]; | |
for(int i=0; i<n; i++) | |
{ |
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 Solution { | |
public void sortColors(int[] A) { | |
// Start typing your Java solution below | |
// DO NOT write main() function | |
int end=A.length; | |
int start=-1; | |
for(int i=0; i<end; i++) | |
{ | |
if(A[i]==0) | |
{ |
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 Solution { | |
public String getPermutation(int n, int k) { | |
// Start typing your Java solution below | |
// DO NOT write main() function | |
if(k<0) return ""; | |
ArrayList<Integer>num=new ArrayList<Integer>(); | |
int sum=1; | |
for(int i=1; i<=n; i++) | |
{ | |
sum*=i; num.add(i); |
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 Solution { | |
public ArrayList<ArrayList<Integer>> permuteUnique(int[] num) { | |
// Start typing your Java solution below | |
// DO NOT write main() function | |
return permutation( num, num.length-1, new HashSet<ArrayList<Integer>>()); | |
} | |
ArrayList<ArrayList<Integer>> permutation(int [] num, int end, HashSet<ArrayList<Integer>> set) | |
{ | |
ArrayList<ArrayList<Integer>> result=new ArrayList<ArrayList<Integer>> (); | |
if(end<0) |
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 Solution { | |
public ArrayList<ArrayList<Integer>> permute(int[] num) { | |
// Start typing your Java solution below | |
// DO NOT write main() function | |
return permutation( num, num.length-1); | |
} | |
ArrayList<ArrayList<Integer>> permutation(int [] num, int end) | |
{ | |
ArrayList<ArrayList<Integer>> result=new ArrayList<ArrayList<Integer>> (); | |
if(end<0) |
NewerOlder