- ๐ป Software Engineer at @Google
- ๐น YouTuber with 130k+ subscribers
- ๐ข Ex Software Engineer at @Cure.fit
- ๐ข Former SDE Intern at @SAP Labs
- ๐จโ๐ซ Ex Educator @Codechef
- ๐จโ๐ซ Ex Educator @Unacademy
- ๐ฌ Feel free to contact me at [email protected]
- ๐ Pronouns: He/Him
frazarmy's Introduction
frazarmy's People
Forkers
unresolvedcold nilabjasarkar123 mantoshpattanayak moyen-7 vishal-k-988 irajshaikh kranthik01 shashank5665 md-arfin-cse randomhimanshu prudhvi-teja mspatild7 ankita971 i-am-guruji pravarjain19 rohan9896 niraj-suryavanshi satyamrakhonde manikgo santoshk99 drhhusain pooja2355 rohangore1999 abhayrajak06 bhaviksojitra killerstrike17 icodein tanishq14developer mankhakb rahul3am shivam-ok naval22 tushargit1 prabhatnayak soumen-coder yuganshmahajan originalkaran raju1409 1023megha moazzam-matin ayushluthra2001 jsmartis05 soumenm1 mohan259 paragrao prabhatjadab dark1programmer satyam-2026 aravind-sridhar gagank49 devduttrai hacker-big-brain anilawashyaa monikluthra shikhakothiyal992 akashlahane netravatisaravi achyut132002 sushantshekhar82 n865c mohitsolunke jeba1996 sudeep20000 jagadeeshshetty vishnutejass alexanderking356bc prajnasbhat snehilvukkusila ayushnagar-jpg nirbhay-gandhifrazarmy's Issues
code exceeds time limit for one testcase
import java.util.*;
public class Solution {
public void helperset(ArrayList<Integer> arrset,int i,ArrayList<Integer> subSet,
ArrayList<ArrayList<Integer>> ans){
if(i==arrset.size()){
if(!ans.contains(subSet))
ans.add(subSet);
return ;
}
subSet.add(arrset.get(i));
helperset(arrset,i+1,new ArrayList<>(subSet),ans);
subSet.remove(arrset.get(i));
helperset(arrset,i+1,new ArrayList<>(subSet),ans);
}
public static ArrayList<ArrayList<Integer>> uniqueSubsets(int n, int arr[]) {
// Write your code here..
ArrayList<ArrayList<Integer>> ans = new ArrayList<ArrayList<Integer>> ();
ArrayList<Integer> subSet = new ArrayList<Integer>();
ArrayList<Integer> arrset = new ArrayList<Integer>();
Arrays.sort(arr);
for(int i=0;i<n;i++){
arrset.add(arr[i]);
}
Solution x =new Solution();
x.helperset(arrset,0,subSet,ans);
Collections.sort(ans, new Comparator<List<Integer>>() {
public int compare(List<Integer> o1, List<Integer> o2) {
int min = Math.min(o1.size(),o2.size());
for(int i=0;i<min;i++)
{
if(o1.get(i)!=o2.get(i))
{
return o1.get(i).compareTo(o2.get(i));
}
}
return (o1.size()<=o2.size())? -1:1;
}
});
return ans;
}
}
Episode 6 - Reverse an array using recursion
There seems to be some problem with the java code for episode 6, would be great if you could look into it.
Thankyou
I am seeing issues with java code from episode 5 onwards i have commented working code in comment section of each java file Please see once ,Thanks for videos
Python Recursion powerset of array fix
use the following as the base condition, the former one will pass the subSet as reference and all will be empty
if i == len(v):
ans.append(subSet.copy())
return
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.