LeetCode #1: Two Sum I | Facebook Coding Interview | LeetCode Two Sum Java

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

Watch all my playlist here:

Want to land a software engineering job in the IT industry? This course - 'Visualizing Data Structures and Algorithms' is here to help. The course walks you through multiple Java algorithms, data structures problems, and their solutions with step by step visualizations, so that you are actually learning instead of blindly memorizing solutions.

The course covers in and outs of Data Structures and Algorithms in Java. Java is used as the programming language in the course. Students familiar with Javascript, Python, C#, C++, C, etc will also get to learn concepts without any difficulty. The implementation of various Algorithms and Data Structures have been demonstrated and implemented through animated slides. It covers many interview room questions on Algorithms and Data Structures. The questions and solutions are demonstrated by -

1. Animated slide. (To make visualization of algorithms faster)
2. Coding algorithm on IDE.

The course covers topics such as -
0. Algorithm Analysis
1. Arrays
2. Matrix
3. Singly Linked List
4. Doubly Linked List
5. Circular Singly Linked List
6. Stacks
7. Queues
8. Binary Tree
9. Binary Search Tree
10. Graphs
11. Priority Queues and Heaps
12. Recursion
13. Searching
14. Sorting
15. Strings
16. Trie Data Structure
17. Dynamic Programming
and many more ...

#dsa #algorithms #coding
Рекомендации по теме
Комментарии
Автор

One of the best video I saw for the stated problem !!! Thanks Dinesh

vishravas
Автор

Your playlist is like energy drink, i need before my DSA interviews...helped me changeing job last year and i am sure will help me this year as well...thanks a lot bro for this wonderful

shubhamagarwal
Автор

Best series for DS & Algo. I am also 10 yrs java exp guy. Was looking for DS & Algo free course over YouTube with java implementation and found this. Hats Off To You Man...Excellent Work. GOD BLESS YOU :)

shubhamagarwal
Автор

One of the great video I have watched for this question.Thanks for the great explanation sir.

saikrishna-cytr
Автор

nice explanation, please make videos on java Collection too

ameenurrehman
Автор

thanks sir because I have seen this problem in service based company exam and product based exam Iam confused about this logic all time

besspallysaikiran
Автор

I love trying it out myself before watching the video and this is what I came up with instead of looking HashMaps for anybody looking:

public static int[] findPairBySum(int[] arr, int target) {

int first = 0, second = 0;

for (int i = 0; i < arr.length; i++) {
for (int j = 1; j < arr.length; j++) {
if (arr[i] + arr[j] == target) {
= i;
= j;
}
}
}

int[] newArray = {first, second};
return newArray;
}
// _Finally you can use _*_toString()_*_ method of _*_Java.util.Arrays_*_ class to get the result_

raz
Автор

way of your explanation its pretty good..

kidsfun
Автор

I haven't watched even the complete video i just watched the video till 6:42 only and i understood the code

saikrishna-cytr
Автор

sir, what is hash table now?? it was not explained in your previous :-(

Devil-dnew
Автор

Sir! Can u make a video on Kadane's algorithm 🙏

arijitmohapatra
Автор

Another solution but not optimal : int[] result = new int[2];
for (int i=0; i< numbers.length; i++){
for (int j=i+1; j< numbers.length; j++){
if (numbers[i] + numbers[j] == target){
result[0] = i;
result[1] = j;
return result;
}
}
}
return result;

karentechnologies
Автор

class Myclass
{
public int[] sum(int[] array, int target)
{
for(int i=0;i<array.length;i++)
{
for(int j=i+1;j<array.length;j++)
{
if(target==array[i]+array[j])
{
return new int[] {i, j};
}

}
}
return new int[2];
}
}
public class Main
{
public static void main(String[] args)
{
Myclass m=new Myclass();
int[] x=m.sum(new int[] {1, 2, 3, 4}, 7);
System.out.println("required ans is:-"+x.length);
for(int i=0;i<x.length;i++)
System.out.print(x[i]+" ");
}
}
which one will take less time, code you made or me?

vasudevparmar
Автор

Best series for DS & Algo. I am also 10 yrs java exp guy. Was looking for DS & Algo free course over YouTube with java implementation and found this. Hats Off To You Man..Excellent Work. GOD BLESS YOU :)

shubhamagarwal
join shbcf.ru