All Indices in Array - Solution | Recursion | Data Structures and Algorithms in JAVA

preview_player
Показать описание


#pepcoding #programming #freeonlinecourses
Рекомендации по теме
Комментарии
Автор

randomly started watching recursion tutorials playlist from your channel at around 12:00 am, now its 3:25 am and i am half way through it! (24/53), i cant tell you how brilliantly you have explained the concepts! I would definitely complete it and also complete all the major parts of Data Structures and Algorithms from your channel! Thank you so much Sir! I really appreciate your efforts!

dheerajbarik
Автор

This is GOLD!! I came here after someone's LinkedIn post. First watched Tower of Hanoi from your channel.I am hooked now.

saurabhanand
Автор

I have tears in my eyes at how brilliantly Sir explains such complex concepts with so much ease. Thank you for coming on YouTube and uploading such brilliant content for free.

khyatibeads
Автор

I was about to give up on DSA. But after watching your videos of the recursion series for the first time, I realized, "I shouldn't".

anujkumarnath
Автор

I don't think there could be a better explanation of this question with so much patience you explain the concepts make it crystal clear.

shivangsharma
Автор

After trying so many times, move here and there, done with everything to learn recursion but was not able to understand this topic . Everyone was saying recursion is a magic but I was not able to see that magic but sir You, I do not have words to describe your efforts, Thank you so much sir. You made it really easy thank you so much.

shalugupta
Автор

this channel deserves 1million subscribers...already shared with all my friends all across the platforms

adheeshmishra
Автор

I was following you from starting of recursion. I solved this question by own. I am literally so happy sir.. Just because of you now I can show magics in recursion. I am very pumped up

Actually I use cpp so I used stack and I kept pushing_back while moving from start to end only and when I reached the end I returned the vector.
.. Thankss

neerajmahapatra
Автор

Only few people can do this great cause. Serving the community in such a nice way. Thanks!

lilshriya
Автор

thankyou so much for holding our finger and taking us through the solution step by step, i am a slow learner and i need detailed explanation and you do the wonders

harshitaninama
Автор

Never Understand the recursive Concept Like this. Great work Sir and Thank you for making recursion crystal clear

trisha
Автор

kya clarity hai ek dum crystal clear hojata hai concept!! Thank you so much sir!!

sakshiaggarwal
Автор

I usually don't comment but I can't stop myself to comment that "Bhai maza aa gya"....Itna depth me recursion koi nhi padhata

anweshangoswami
Автор

I watched the first vedio for trial and now I can't stop myself from watching your vedios

Rajyadav-lldk
Автор

Best teacher I have been ever seen since nursery class.

knightrec
Автор

also, take a note that this playlist is the best playlist for recursion. you have just reborn my interest in coding.

vivekbharti
Автор

You dont know sir, i was totally blank after watching other youtube videos about recursion, backtracking btt your channel give me hope and confidentt too, that i can also solve some recursion questions

amritatiwary.
Автор

Wish I knew about you in the start of my 1st year, it would have been a bliss fore me sir!

anmolverma
Автор

First of all, thanks for this recursion playlist. And
Sir you dry run makes a recursion very very easy.
keep uploading playlist we will always support you.

rajneeshsahuit
Автор

This was my approach->

import java.io.*;
import java.util.*;

public class Main {

public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new
int n =
int[] arr = new int[n];

for (int i = 0; i < n; i++) {
arr[i] =
}
int x =
int[] iarr = allIndices(arr, x, 0, 0);

if (iarr.length == 0) {
System.out.println();
return;
}

for (int i = 0; i < iarr.length; i++) {
System.out.println(iarr[i]);
}
}

public static int[] allIndices(int[] arr, int x, int idx, int fsf) {
if (arr.length == idx) {
return new int[fsf];
}
if (arr[idx] == x) {
fsf++;
}
int[] ans = allIndices(arr, x, idx + 1, fsf);
if (arr[idx] == x) {
ans[--fsf] = idx;
}
return ans;
}

}

_rahulsain