title
Find Second Largest Element in Array | Remove duplicates from Sorted Array | Arrays Intro Video

description
Notes/C++/Java/Python codes in Step 3.1 of https://bit.ly/tufA2ZYt Largest Element: https://takeuforward.org/data-structure/find-the-largest-element-in-an-array/ Second Largest: https://takeuforward.org/data-structure/find-second-smallest-and-second-largest-element-in-an-array/ Check if Sorted: https://takeuforward.org/data-structure/check-if-an-array-is-sorted/ Remove Duplicates: https://takeuforward.org/data-structure/remove-duplicates-in-place-from-sorted-array/ Practice Link: Largest Element: https://bit.ly/3CuLIR3 Second Largest: https://bit.ly/3GJie4l Check if Sorted: https://bit.ly/3XsgYIH Remove duplicates: https://bit.ly/3if2k8G Full Course: https://bit.ly/tufA2ZYt You can follow me across social media, all my handles are below: Linkedin/Instagram/Telegram: https://linktr.ee/takeUforward 0:00 Introduction of Course 0:54 Basics of array 6:33 Introduction of Brute, Better and Optimal Approaches 8:50 Largest element in an array 11:39 Pseudo code 12:44 Code-compiler 13:30 Second Largest element in an array 23:48 coding implementation 28:42 Check if the array is sorted 30:00 Pseudo code 30:49 Code-compiler 31:26 Remove duplicates in place from Sorted array 40:40 Pseudo code 42:12 Code-compiler

detail
{'title': 'Find Second Largest Element in Array | Remove duplicates from Sorted Array | Arrays Intro Video', 'heatmap': [{'end': 835.089, 'start': 780.61, 'weight': 0.727}, {'end': 1044.208, 'start': 1014.64, 'weight': 0.7}, {'end': 1121.248, 'start': 1068.663, 'weight': 0.777}, {'end': 1694.127, 'start': 1667.043, 'weight': 0.715}, {'end': 1905.556, 'start': 1876.483, 'weight': 0.701}, {'end': 2115.348, 'start': 2084.614, 'weight': 0.76}, {'end': 2218.826, 'start': 2160.163, 'weight': 0.73}, {'end': 2372.588, 'start': 2345.035, 'weight': 0.716}, {'end': 2555.864, 'start': 2421.44, 'weight': 0.743}], 'summary': 'Covers fundamental array concepts including declaration, representation, and problem-solving strategies with 400+ solved problems and 456 modules. it emphasizes finding largest and second largest elements with time complexities of n log n and o(n), and discusses removing duplicates from sorted arrays and unique set optimization.', 'chapters': [{'end': 394.071, 'segs': [{'end': 69.31, 'src': 'embed', 'start': 23.967, 'weight': 0, 'content': [{'end': 29.249, 'text': 'in this course alone we will be solving 400 plus problems on ds algo.', 'start': 23.967, 'duration': 5.282}, {'end': 38.994, 'text': 'so at the end of the course you will be so well versed with ds algo that you can clear any of the ds algo rounds in any of the interviews in any of the companies in any part of the world.', 'start': 29.249, 'duration': 9.745}, {'end': 41.595, 'text': 'so till now we have completed till step two.', 'start': 38.994, 'duration': 2.601}, {'end': 44.917, 'text': 'today we will be starting with step three, which is nothing but arrays.', 'start': 41.595, 'duration': 3.322}, {'end': 51.521, 'text': 'so in order to understand arrays, what we will be doing is we will be solving 41 different problems.', 'start': 45.257, 'duration': 6.264}, {'end': 57.404, 'text': "so before moving into the problems, let's understand some basic stuffs about array.", 'start': 51.521, 'duration': 5.883}, {'end': 60.025, 'text': 'so when i say array, what is an array?', 'start': 57.404, 'duration': 2.621}, {'end': 66.409, 'text': 'so array is nothing but a data structure which contains similar elements.', 'start': 60.025, 'duration': 6.384}, {'end': 69.31, 'text': 'now, what do i mean by similar elements?', 'start': 66.409, 'duration': 2.901}], 'summary': 'This course covers 400+ problems in ds algo, preparing you for interviews worldwide, currently at step 3 - arrays.', 'duration': 45.343, 'max_score': 23.967, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/37E9ckMDdTk/pics/37E9ckMDdTk23967.jpg'}, {'end': 266.67, 'src': 'embed', 'start': 239.945, 'weight': 2, 'content': [{'end': 244.109, 'text': 'so if i declare the array globally, then it will be 10 to the power 7.', 'start': 239.945, 'duration': 4.164}, {'end': 245.79, 'text': 'it will be 10 to the power 7.', 'start': 244.109, 'duration': 1.681}, {'end': 250.174, 'text': 'so the max size is 10 to the power 7.', 'start': 245.79, 'duration': 4.384}, {'end': 254.057, 'text': 'if you go ahead and declare it globally, remember this.', 'start': 250.174, 'duration': 3.883}, {'end': 256.94, 'text': 'Now the next thing how do you access an array?', 'start': 254.778, 'duration': 2.162}, {'end': 259.702, 'text': 'So there is something known as index.', 'start': 257.481, 'duration': 2.221}, {'end': 266.67, 'text': 'So in an array, the first index is 0 followed by 1, then 2, then 3, then 4.', 'start': 260.264, 'duration': 6.406}], 'summary': 'Globally declaring the array sets max size to 10^7. access array using indexes starting at 0.', 'duration': 26.725, 'max_score': 239.945, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/37E9ckMDdTk/pics/37E9ckMDdTk239945.jpg'}, {'end': 394.071, 'src': 'embed', 'start': 367.349, 'weight': 4, 'content': [{'end': 372.913, 'text': 'the next at x plus 3, the next at x plus 4, and the next at x plus 5..', 'start': 367.349, 'duration': 5.564}, {'end': 378.916, 'text': 'So contiguous memory locations is where all the corresponding indexes will be stored.', 'start': 372.913, 'duration': 6.003}, {'end': 380.717, 'text': 'but we cannot predict x.', 'start': 378.916, 'duration': 1.801}, {'end': 385.02, 'text': 'thereby accessing an array by address is not possible.', 'start': 380.717, 'duration': 4.303}, {'end': 388.004, 'text': 'hence we address it by an index.', 'start': 385.02, 'duration': 2.984}, {'end': 390.607, 'text': 'so this was about the basics of the array.', 'start': 388.004, 'duration': 2.603}, {'end': 392.409, 'text': "now let's move on to the problem solving.", 'start': 390.607, 'duration': 1.802}, {'end': 394.071, 'text': 'so coming to step 3.1.', 'start': 392.409, 'duration': 1.662}], 'summary': 'Array stores items at contiguous memory locations. accessing by address not possible.', 'duration': 26.722, 'max_score': 367.349, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/37E9ckMDdTk/pics/37E9ckMDdTk367349.jpg'}], 'start': 3.254, 'title': 'Arrays in data structures', 'summary': 'Covers the fundamentals of arrays in data structures, including their definition, representation, and declaration, with 400+ problems solved and 456 modules offered. it also covers array basics in c++, java, and potentially python, including maximum size, indexing, and memory storage, with a global declaration maximum size of 10^7, and explains memory storage for arrays in computer memory.', 'chapters': [{'end': 189.603, 'start': 3.254, 'title': 'Arrays in data structures', 'summary': 'Covers the fundamentals of arrays in data structures, including the definition, representation, and declaration of arrays, with a promise of 400+ problems solved and 456 modules offered in the course.', 'duration': 186.349, 'highlights': ['The course promises to solve 400+ problems and offers 456 modules, ensuring a comprehensive understanding of data structures and algorithms.', 'The chapter delves into the fundamentals of arrays, intending to solve 41 different problems to establish a solid understanding of arrays in data structures.', 'The definition of an array is provided, emphasizing that it is a data structure containing similar elements of the same data type.', 'The representation and declaration of arrays, including the size and declaration method in Java, are explained.', 'The difference in the initialization of arrays inside and outside the main function is highlighted, stating that global array declaration initializes all elements with zeros.']}, {'end': 394.071, 'start': 189.603, 'title': 'Array basics and problem solving', 'summary': 'Covers the basics of arrays in c++, java, and potentially python, including the maximum size of arrays, array indexing, and memory storage, with the maximum size of an array being 10^7 when declared globally. it also explains how to access array elements and the memory storage for arrays in computer memory.', 'duration': 204.468, 'highlights': ['The maximum size of an array is 10^7 when declared globally.', 'The first index of an array is 0, and the last index is size minus 1.', 'Arrays are stored in contiguous memory locations, with each element being stored at an incrementing memory address.']}], 'duration': 390.817, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/37E9ckMDdTk/pics/37E9ckMDdTk3254.jpg', 'highlights': ['The course promises to solve 400+ problems and offers 456 modules, ensuring a comprehensive understanding of data structures and algorithms.', 'The chapter delves into the fundamentals of arrays, intending to solve 41 different problems to establish a solid understanding of arrays in data structures.', 'The maximum size of an array is 10^7 when declared globally.', 'The definition of an array is provided, emphasizing that it is a data structure containing similar elements of the same data type.', 'Arrays are stored in contiguous memory locations, with each element being stored at an incrementing memory address.']}, {'end': 1231.997, 'segs': [{'end': 455.184, 'src': 'embed', 'start': 394.071, 'weight': 2, 'content': [{'end': 397.695, 'text': 'the first problem is largest element in an array.', 'start': 394.071, 'duration': 3.624}, {'end': 401.119, 'text': 'so before moving on to the problem, i want you to tell something now.', 'start': 397.695, 'duration': 3.424}, {'end': 404.402, 'text': 'whenever you go to an interview, the interviewer will give you a question.', 'start': 401.119, 'duration': 3.283}, {'end': 408.626, 'text': 'But if you know the solution, should you say the solution directly?', 'start': 405.043, 'duration': 3.583}, {'end': 410.387, 'text': 'The answer to that is no.', 'start': 408.906, 'duration': 1.481}, {'end': 412.569, 'text': 'There is a reason why you are preparing.', 'start': 410.988, 'duration': 1.581}, {'end': 415.211, 'text': 'You might know the solution, but you should not tell it.', 'start': 412.649, 'duration': 2.562}, {'end': 416.952, 'text': 'You should build the interview.', 'start': 415.631, 'duration': 1.321}, {'end': 418.994, 'text': "It's you who should drive the interview.", 'start': 417.172, 'duration': 1.822}, {'end': 422.457, 'text': 'When I say drive the interview, this is a very easy question.', 'start': 419.454, 'duration': 3.003}, {'end': 428.36, 'text': 'but when i say drive the interview, imagine you have been asked a hard question and you know the optimized,', 'start': 423.217, 'duration': 5.143}, {'end': 433.463, 'text': 'like the most optimized solution in terms of time complexity and space complexity.', 'start': 428.36, 'duration': 5.103}, {'end': 437.445, 'text': 'should you say it directly whenever you are given the question?', 'start': 433.463, 'duration': 3.982}, {'end': 440.127, 'text': 'no, you should drive the interview at first.', 'start': 437.445, 'duration': 2.682}, {'end': 442.508, 'text': 'you should ask him about test cases.', 'start': 440.127, 'duration': 2.381}, {'end': 448.352, 'text': "then, once you've understood the question properly, you should give him the brute force solution, which is the like,", 'start': 442.508, 'duration': 5.844}, {'end': 452.623, 'text': 'the most normal solution that comes to your brain at first.', 'start': 448.352, 'duration': 4.271}, {'end': 455.184, 'text': 'that is what you call as a brute force solution.', 'start': 452.623, 'duration': 2.561}], 'summary': "In an interview, don't directly give solutions, drive the interview by asking about test cases and providing brute force solution first.", 'duration': 61.113, 'max_score': 394.071, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/37E9ckMDdTk/pics/37E9ckMDdTk394071.jpg'}, {'end': 545.061, 'src': 'embed', 'start': 517.595, 'weight': 0, 'content': [{'end': 521.136, 'text': 'you actually are kind of always speaking brute, better, optimal.', 'start': 517.595, 'duration': 3.541}, {'end': 523.558, 'text': 'Okay. so, coming back to the problem.', 'start': 521.337, 'duration': 2.221}, {'end': 526.181, 'text': 'Finding the largest element in an array.', 'start': 524.119, 'duration': 2.062}, {'end': 533.486, 'text': 'What does the problem mean? Obviously, given an array of integers, give me the largest integer in it.', 'start': 526.341, 'duration': 7.145}, {'end': 536.448, 'text': 'So over here, the largest integer is 5.', 'start': 533.886, 'duration': 2.562}, {'end': 538.469, 'text': 'So I want you to give me 5.', 'start': 536.448, 'duration': 2.021}, {'end': 540.251, 'text': 'How can you do this? Very simple.', 'start': 538.469, 'duration': 1.782}, {'end': 545.061, 'text': 'If I have to ask you what is the brute force solution that comes to your mind?', 'start': 541.4, 'duration': 3.661}], 'summary': 'Finding largest integer in array, 5 is the largest element.', 'duration': 27.466, 'max_score': 517.595, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/37E9ckMDdTk/pics/37E9ckMDdTk517595.jpg'}, {'end': 835.089, 'src': 'heatmap', 'start': 780.61, 'weight': 0.727, 'content': [{'end': 788.275, 'text': "like vector is also a data structure which stores similar elements it is okay like it will be considered like it's not an array.", 'start': 780.61, 'duration': 7.665}, {'end': 796.682, 'text': "But the problems can be solved using arrays, using lists, using vectors, because it's a data structure which is storing similar integers.", 'start': 788.755, 'duration': 7.927}, {'end': 798.363, 'text': 'You might find something like a vector.', 'start': 797.042, 'duration': 1.321}, {'end': 800.845, 'text': 'Got it? The problem link is in the description.', 'start': 798.583, 'duration': 2.262}, {'end': 804.088, 'text': "So when you go to online compilers, you don't have to print it.", 'start': 801.345, 'duration': 2.743}, {'end': 806.109, 'text': 'Usually they will be asking you to return it.', 'start': 804.288, 'duration': 1.821}, {'end': 808.752, 'text': 'So you can easily go ahead and return it like this.', 'start': 806.189, 'duration': 2.563}, {'end': 814.996, 'text': 'So going to the next problem, it states second largest element in an array without sorting.', 'start': 809.352, 'duration': 5.644}, {'end': 820.279, 'text': 'This question might look very, very simple, but this question is very, very commonly asked in an interview,', 'start': 815.336, 'duration': 4.943}, {'end': 822.941, 'text': 'because a lot of people do not know how to solve it.', 'start': 820.279, 'duration': 2.662}, {'end': 826.503, 'text': 'So they might ask you second largest or they might ask you second smallest.', 'start': 823.241, 'duration': 3.262}, {'end': 833.508, 'text': 'So the pattern that you have to answer in an interview is you start from root, then you go to better, then you go to optimal.', 'start': 826.884, 'duration': 6.624}, {'end': 835.089, 'text': "That's how you will be solving it.", 'start': 833.788, 'duration': 1.301}], 'summary': 'Vectors, arrays, and lists are common data structures for storing integers. interview questions often involve finding the second largest or smallest element without sorting.', 'duration': 54.479, 'max_score': 780.61, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/37E9ckMDdTk/pics/37E9ckMDdTk780610.jpg'}, {'end': 1044.208, 'src': 'heatmap', 'start': 1014.64, 'weight': 0.7, 'content': [{'end': 1017.321, 'text': 'You should tell the interviewer by yourself these cases.', 'start': 1014.64, 'duration': 2.681}, {'end': 1027.084, 'text': 'So I can say the total overall complexity of the brute force solution is first I sort and the worst case I might travel the entire way in order,', 'start': 1017.801, 'duration': 9.283}, {'end': 1030.846, 'text': 'just in case all of them are largest elements.', 'start': 1027.084, 'duration': 3.762}, {'end': 1033.987, 'text': "So that's how you'll be telling the brute force approach.", 'start': 1031.205, 'duration': 2.782}, {'end': 1041.507, 'text': 'So what will be a better solution? A better solution will be like we will do a first Yes, first pass.', 'start': 1034.146, 'duration': 7.361}, {'end': 1044.208, 'text': "And we'll find out the largest element.", 'start': 1042.347, 'duration': 1.861}], 'summary': 'Brute force complexity: o(nlogn). better solution: find largest element in first pass.', 'duration': 29.568, 'max_score': 1014.64, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/37E9ckMDdTk/pics/37E9ckMDdTk1014640.jpg'}, {'end': 1121.248, 'src': 'heatmap', 'start': 1068.663, 'weight': 0.777, 'content': [{'end': 1069.603, 'text': 'Then I again go to 7.', 'start': 1068.663, 'duration': 0.94}, {'end': 1071.685, 'text': '7, are you greater than 7? He says no.', 'start': 1069.603, 'duration': 2.082}, {'end': 1072.566, 'text': 'Then I go to 5.', 'start': 1072.145, 'duration': 0.421}, {'end': 1074.628, 'text': '5, are you greater than 7? No.', 'start': 1072.566, 'duration': 2.062}, {'end': 1079.632, 'text': 'So the largest on the first pass is stored as 7.', 'start': 1074.968, 'duration': 4.664}, {'end': 1081.914, 'text': 'And the code will be similar to the first one.', 'start': 1079.632, 'duration': 2.282}, {'end': 1084.376, 'text': 'So you have figured out the largest pass.', 'start': 1082.274, 'duration': 2.102}, {'end': 1087.247, 'text': 'over here by doing a first pass.', 'start': 1084.966, 'duration': 2.281}, {'end': 1094.17, 'text': "now what you will do is you will say okay, let's keep second largest as minus one.", 'start': 1087.247, 'duration': 6.923}, {'end': 1099.801, 'text': "let's again try the same thing, one, Hey, 1..", 'start': 1094.17, 'duration': 5.631}, {'end': 1101.702, 'text': 'Are you greater than minus 1? He says yes.', 'start': 1099.801, 'duration': 1.901}, {'end': 1104.303, 'text': 'And are you not largest? He says yes.', 'start': 1102.282, 'duration': 2.021}, {'end': 1106.323, 'text': 'So I will take 1.', 'start': 1104.923, 'duration': 1.4}, {'end': 1107.804, 'text': 'And that will be my second largest.', 'start': 1106.323, 'duration': 1.481}, {'end': 1109.304, 'text': "Okay Let's go ahead.", 'start': 1108.224, 'duration': 1.08}, {'end': 1111.425, 'text': 'He says 2.', 'start': 1110.125, 'duration': 1.3}, {'end': 1113.246, 'text': 'Are you greater than 1? He says yes.', 'start': 1111.425, 'duration': 1.821}, {'end': 1115.786, 'text': 'But are you not largest? He says yes.', 'start': 1113.786, 'duration': 2}, {'end': 1116.967, 'text': 'So thereby.', 'start': 1116.427, 'duration': 0.54}, {'end': 1118.687, 'text': 'I take 2.', 'start': 1116.987, 'duration': 1.7}, {'end': 1119.327, 'text': 'Then I go to 4.', 'start': 1118.687, 'duration': 0.64}, {'end': 1121.248, 'text': 'And I ask 4.', 'start': 1119.327, 'duration': 1.921}], 'summary': 'Finding the largest and second largest numbers in a sequence.', 'duration': 52.585, 'max_score': 1068.663, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/37E9ckMDdTk/pics/37E9ckMDdTk1068663.jpg'}, {'end': 1201.756, 'src': 'embed', 'start': 1169.484, 'weight': 1, 'content': [{'end': 1175.617, 'text': "just in case there is none, and you can say second largest, it's greater.", 'start': 1169.484, 'duration': 6.133}, {'end': 1187.384, 'text': 'and if array of i is not equal to largest, then you can say second largest, equal to array of i.', 'start': 1175.617, 'duration': 11.767}, {'end': 1190.225, 'text': 'quite simple, this will be a second pass.', 'start': 1187.384, 'duration': 2.841}, {'end': 1193.567, 'text': 'first you write this, this piece of code,', 'start': 1190.225, 'duration': 3.342}, {'end': 1201.756, 'text': 'then you can write this piece of code and at the end of the day you can easily go ahead and print second largest.', 'start': 1193.567, 'duration': 8.189}], 'summary': 'Identify and print the second largest number in an array using a simple piece of code.', 'duration': 32.272, 'max_score': 1169.484, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/37E9ckMDdTk/pics/37E9ckMDdTk1169484.jpg'}], 'start': 394.071, 'title': 'Interview strategy for problem solving and finding largest elements in array', 'summary': 'Emphasizes interview strategies for problem solving, including starting with test cases, providing brute force solution, and optimizing to the most efficient solution. it also discusses finding the largest and second largest elements in an array, with time complexities of n log n and o(n) for brute force and optimal solutions, respectively.', 'chapters': [{'end': 517.595, 'start': 394.071, 'title': 'Interview strategy for problem solving', 'summary': 'Emphasizes the importance of driving the interview by starting with test cases, providing a brute force solution, and then optimizing to the most efficient solution, while highlighting the need to demonstrate problem-solving skills and not immediately revealing the solution.', 'duration': 123.524, 'highlights': ['The importance of driving the interview by starting with test cases, providing a brute force solution, and then optimizing to the most efficient solution.', 'The need to demonstrate problem-solving skills and not immediately reveal the solution.', 'The suggestion to avoid directly stating the solution and instead drive the interview.', 'The recommendation to get accustomed to the interview pattern by following it in easier problems.', 'The statement that in harder problems, candidates need to follow the process of leading the interview.']}, {'end': 1231.997, 'start': 517.595, 'title': 'Finding largest and second largest element in array', 'summary': 'Discusses finding the largest and second largest element in an array. the brute force solution involves sorting the array, resulting in a time complexity of n log n, while the optimal solution involves a simple iteration, resulting in a time complexity of o(n). the second problem of finding the second largest element without sorting is also discussed, with the brute force solution involving sorting and the better solution involving two passes with a time complexity of o(2n).', 'duration': 714.402, 'highlights': ['The optimal solution for finding the largest element in an array involves iterating through the array once, resulting in a time complexity of O(n), which is much better than the brute force solution involving sorting with a time complexity of O(n log n).', 'The better solution for finding the second largest element in an array involves two passes, with the first pass finding the largest element and the second pass finding the second largest element, resulting in a time complexity of O(2n).', 'The brute force solution for finding the largest element involves sorting the array, resulting in a time complexity of O(n log n), which is less efficient than the optimal solution that involves a simple iteration with a time complexity of O(n).', 'The brute force solution for finding the second largest element involves sorting the array, which results in a time complexity of O(n log n), while the better solution involves two passes with a time complexity of O(2n).']}], 'duration': 837.926, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/37E9ckMDdTk/pics/37E9ckMDdTk394071.jpg', 'highlights': ['The optimal solution for finding the largest element in an array involves iterating through the array once, resulting in a time complexity of O(n), which is much better than the brute force solution involving sorting with a time complexity of O(n log n).', 'The better solution for finding the second largest element in an array involves two passes, with the first pass finding the largest element and the second pass finding the second largest element, resulting in a time complexity of O(2n).', 'The importance of driving the interview by starting with test cases, providing a brute force solution, and then optimizing to the most efficient solution.', 'The need to demonstrate problem-solving skills and not immediately reveal the solution.', 'The suggestion to avoid directly stating the solution and instead drive the interview.']}, {'end': 1885.245, 'segs': [{'end': 1306.831, 'src': 'embed', 'start': 1256.136, 'weight': 3, 'content': [{'end': 1260.398, 'text': "So I'm saying, okay, the first guy is my largest for sure.", 'start': 1256.136, 'duration': 4.262}, {'end': 1263.78, 'text': "So I'm kind of taking 1 as my largest.", 'start': 1260.839, 'duration': 2.941}, {'end': 1266.121, 'text': "And I'm saying second largest is minus 1.", 'start': 1263.94, 'duration': 2.181}, {'end': 1271.404, 'text': 'assuming that this array does not contains any negative numbers.', 'start': 1266.121, 'duration': 5.283}, {'end': 1273.306, 'text': "that is an assumption i'm working at.", 'start': 1271.404, 'duration': 1.902}, {'end': 1281.791, 'text': 'in case the array contains negative numbers, you can probably take this as integer minimum integer minimum in all the cases that i have told.', 'start': 1273.306, 'duration': 8.485}, {'end': 1290.196, 'text': 'in case the array contains negative numbers, you can take it as some very small number, like integer minimum or a very, very negative number.', 'start': 1281.791, 'duration': 8.405}, {'end': 1290.436, 'text': 'got it.', 'start': 1290.196, 'duration': 0.24}, {'end': 1297.282, 'text': "so i've largest is assigned as one and second largest is assigned as minus one.", 'start': 1291.457, 'duration': 5.825}, {'end': 1303.948, 'text': "now what you do is you simply go ahead and say okay, fine, let's try this.", 'start': 1297.282, 'duration': 6.666}, {'end': 1305.79, 'text': 'so we know the first guy.', 'start': 1303.948, 'duration': 1.842}, {'end': 1306.831, 'text': 'we should not do anything.', 'start': 1305.79, 'duration': 1.041}], 'summary': 'Determining largest and second largest numbers in an array with assumptions.', 'duration': 50.695, 'max_score': 1256.136, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/37E9ckMDdTk/pics/37E9ckMDdTk1256136.jpg'}, {'end': 1456.827, 'src': 'embed', 'start': 1432.527, 'weight': 0, 'content': [{'end': 1439.172, 'text': "what they're asking is you have to return the second largest and the second smallest, so you have to find both of them.", 'start': 1432.527, 'duration': 6.645}, {'end': 1450.403, 'text': 'so something like you have to find second largest right and then you have to find second smallest, And then you have to return the array of this.', 'start': 1439.172, 'duration': 11.231}, {'end': 1455.306, 'text': 'And in what order? Yeah, first the largest and then the smallest.', 'start': 1451.023, 'duration': 4.283}, {'end': 1456.827, 'text': 'This is what you have to do.', 'start': 1455.846, 'duration': 0.981}], 'summary': 'Task is to find second largest and second smallest numbers and return them in an array.', 'duration': 24.3, 'max_score': 1432.527, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/37E9ckMDdTk/pics/37E9ckMDdTk1432527.jpg'}, {'end': 1694.127, 'src': 'heatmap', 'start': 1667.043, 'weight': 0.715, 'content': [{'end': 1673.651, 'text': "like okay, if you're smaller than the second smallest, then that's perfect,", 'start': 1667.043, 'duration': 6.608}, {'end': 1683.793, 'text': "and the second smallest will just take array of i and once you've done this, return smallest.", 'start': 1673.651, 'duration': 10.142}, {'end': 1688.379, 'text': 'once you have done everything, you can just go ahead and run it, and it should be running absolutely fine does,', 'start': 1683.793, 'duration': 4.586}, {'end': 1691.924, 'text': "and let's quickly submit this and see if it is submitted or not.", 'start': 1688.379, 'duration': 3.545}, {'end': 1694.127, 'text': 'but the problem link is in the description.', 'start': 1691.924, 'duration': 2.203}], 'summary': 'Algorithm should return the second smallest element in the array.', 'duration': 27.084, 'max_score': 1667.043, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/37E9ckMDdTk/pics/37E9ckMDdTk1667043.jpg'}, {'end': 1739.756, 'src': 'embed', 'start': 1713, 'weight': 2, 'content': [{'end': 1718.264, 'text': "that is why it is better than the better solution, and hence it's called the optimal solution.", 'start': 1713, 'duration': 5.264}, {'end': 1720.526, 'text': 'so we are done with the second problem as well.', 'start': 1718.264, 'duration': 2.262}, {'end': 1725.289, 'text': "let's go on to the next problem, which says check if the array is sorted.", 'start': 1720.526, 'duration': 4.763}, {'end': 1727.871, 'text': 'so coming to the problem, check if the array is sorted.', 'start': 1725.289, 'duration': 2.582}, {'end': 1729.681, 'text': 'Very simple problem.', 'start': 1728.88, 'duration': 0.801}, {'end': 1736.044, 'text': "Given an array, you have to see if it's sorted in a non-descending order.", 'start': 1730.341, 'duration': 5.703}, {'end': 1737.145, 'text': 'What does it mean?', 'start': 1736.545, 'duration': 0.6}, {'end': 1739.756, 'text': '1, okay, 2,.', 'start': 1737.165, 'duration': 2.591}], 'summary': "Identifying optimal solutions for array sorting and checking if it's sorted.", 'duration': 26.756, 'max_score': 1713, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/37E9ckMDdTk/pics/37E9ckMDdTk1713000.jpg'}], 'start': 1231.997, 'title': 'Finding largest and smallest in array', 'summary': 'Discusses finding the first and second largest numbers in an array, with no negative numbers, and also covers finding the second largest and second smallest elements in a given array. it suggests using an optimal approach and provides time complexities for the mentioned methods.', 'chapters': [{'end': 1306.831, 'start': 1231.997, 'title': 'Finding first and second largest in array', 'summary': 'Discusses the approach to find the first and second largest numbers in an array, assuming no negative numbers, and suggests using an optimal approach to achieve this.', 'duration': 74.834, 'highlights': ['The optimal approach involves assigning the first element as the largest and -1 as the second largest, assuming the array does not contain negative numbers.', 'In case the array contains negative numbers, you can take a very small number (like integer minimum) as the second largest.', 'To find the first and second largest, iterate through the array and make comparisons to determine the largest and second largest numbers.']}, {'end': 1885.245, 'start': 1306.831, 'title': 'Finding second largest and second smallest', 'summary': 'Discusses the process of finding the second largest and second smallest elements in a given array by iterating through the elements and replacing the largest and smallest accordingly, with a time complexity of o(n). it also covers the method of checking if an array is sorted in non-descending order by comparing each element with the previous one, with a time complexity of o(n).', 'duration': 578.414, 'highlights': ['The process of finding the second largest and second smallest elements involves iterating through the array and replacing the largest and smallest based on comparisons with the elements, with a time complexity of O(n).', 'The method of checking if an array is sorted in non-descending order includes comparing each element with the previous one and returning true if the entire iteration is completed without finding any unsorted pair, with a time complexity of O(n).']}], 'duration': 653.248, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/37E9ckMDdTk/pics/37E9ckMDdTk1231997.jpg', 'highlights': ['To find the first and second largest, iterate through the array and make comparisons to determine the largest and second largest numbers.', 'The process of finding the second largest and second smallest elements involves iterating through the array and replacing the largest and smallest based on comparisons with the elements, with a time complexity of O(n).', 'The method of checking if an array is sorted in non-descending order includes comparing each element with the previous one and returning true if the entire iteration is completed without finding any unsorted pair, with a time complexity of O(n).', 'In case the array contains negative numbers, you can take a very small number (like integer minimum) as the second largest.', 'The optimal approach involves assigning the first element as the largest and -1 as the second largest, assuming the array does not contain negative numbers.']}, {'end': 2255.55, 'segs': [{'end': 1916.168, 'src': 'embed', 'start': 1885.525, 'weight': 2, 'content': [{'end': 1890.546, 'text': "Let's move to the next problem, which is remove duplicates from a sorted array.", 'start': 1885.525, 'duration': 5.021}, {'end': 1895.668, 'text': 'So, coming to the problem, remove duplicates in place from the sorted array.', 'start': 1890.906, 'duration': 4.762}, {'end': 1897.048, 'text': 'What is the problem??', 'start': 1896.208, 'duration': 0.84}, {'end': 1898.789, 'text': 'tell you about.', 'start': 1897.768, 'duration': 1.021}, {'end': 1905.556, 'text': "so you'll be given an array which is definitely a sorted one and it will be containing integers.", 'start': 1898.789, 'duration': 6.767}, {'end': 1910.281, 'text': 'if you see, there are duplicates over here and you need to remove it.', 'start': 1905.556, 'duration': 4.725}, {'end': 1916.168, 'text': "so if i ask you, what are the unique elements in this array, it'll be like one, two and three.", 'start': 1910.281, 'duration': 5.887}], 'summary': 'Problem: remove duplicates from sorted array, given integers. unique elements: 1, 2, 3.', 'duration': 30.643, 'max_score': 1885.525, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/37E9ckMDdTk/pics/37E9ckMDdTk1885525.jpg'}, {'end': 2115.348, 'src': 'heatmap', 'start': 2084.614, 'weight': 0.76, 'content': [{'end': 2087.156, 'text': "right, let's go to the set.", 'start': 2084.614, 'duration': 2.542}, {'end': 2090.257, 'text': "let's keep a pointer here, which is the zeroth index.", 'start': 2087.156, 'duration': 3.101}, {'end': 2095.559, 'text': "like, if i have to write the index, it's like zero, one, two, three, four, five, six.", 'start': 2090.257, 'duration': 5.302}, {'end': 2103.201, 'text': "let's keep an index at the zeroth index And let's go to the first element of the set.", 'start': 2095.559, 'duration': 7.642}, {'end': 2104.782, 'text': "And that's 1.", 'start': 2103.742, 'duration': 1.04}, {'end': 2108.064, 'text': "Let's take that 1 and place it into the 0th index.", 'start': 2104.782, 'duration': 3.282}, {'end': 2115.348, 'text': "Done Once I've done this, let's move index one step ahead because my first place is occupied.", 'start': 2108.544, 'duration': 6.804}], 'summary': 'Demonstrating index manipulation, with 1 placed at 0th index.', 'duration': 30.734, 'max_score': 2084.614, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/37E9ckMDdTk/pics/37E9ckMDdTk2084614.jpg'}, {'end': 2255.55, 'src': 'heatmap', 'start': 2160.163, 'weight': 0, 'content': [{'end': 2163.586, 'text': 'the code is very simple declare index as zero.', 'start': 2160.163, 'duration': 3.423}, {'end': 2165.548, 'text': 'so this is how you iterate in the set.', 'start': 2163.586, 'duration': 1.962}, {'end': 2173.236, 'text': 'just an iterator auto is something which is automatically assigning it to integer, because the set is containing integers.', 'start': 2165.548, 'duration': 7.688}, {'end': 2176.479, 'text': 'by the way, the set stores everything in ascending order.', 'start': 2173.236, 'duration': 3.243}, {'end': 2179.102, 'text': 'the first it will be storing one, then two, then three.', 'start': 2176.479, 'duration': 2.623}, {'end': 2180.883, 'text': 'okay, so i twitter.', 'start': 2179.102, 'duration': 1.781}, {'end': 2183.364, 'text': 'so every time you get one it gets into the index.', 'start': 2180.883, 'duration': 2.481}, {'end': 2184.605, 'text': 'then index plus plus.', 'start': 2183.364, 'duration': 1.241}, {'end': 2185.726, 'text': 'very simple code.', 'start': 2184.605, 'duration': 1.121}, {'end': 2189.248, 'text': 'if i have to analyze the time complexity, what will it be?', 'start': 2185.726, 'duration': 3.522}, {'end': 2194.992, 'text': 'so the set in order to insert x logarithmic of n, the set.', 'start': 2189.248, 'duration': 5.744}, {'end': 2201.676, 'text': 'okay, so it will be like n logarithmic of n for this particular first pass.', 'start': 2194.992, 'duration': 6.684}, {'end': 2204.983, 'text': 'Again, this one is n.', 'start': 2202.802, 'duration': 2.181}, {'end': 2213.144, 'text': 'So the overall time complexity for the brute force approach is n log n to insert into the set and a big O of n.', 'start': 2204.983, 'duration': 8.161}, {'end': 2218.826, 'text': 'And what space are you using? Using a big O of n space, y n space.', 'start': 2213.144, 'duration': 5.682}, {'end': 2221.866, 'text': 'Imagine all of those were unique elements.', 'start': 2219.306, 'duration': 2.56}, {'end': 2223.587, 'text': 'All of those were unique elements.', 'start': 2222.347, 'duration': 1.24}, {'end': 2227.37, 'text': 'so the set would have taken everything into it.', 'start': 2224.227, 'duration': 3.143}, {'end': 2230.172, 'text': "that's why, that's why the extra space is there.", 'start': 2227.37, 'duration': 2.802}, {'end': 2233.816, 'text': "there's an extra space of b go of n being used as well.", 'start': 2230.172, 'duration': 3.644}, {'end': 2235.257, 'text': 'so this is the tc.', 'start': 2233.816, 'duration': 1.441}, {'end': 2237.379, 'text': 'this is the space complexity.', 'start': 2235.257, 'duration': 2.122}, {'end': 2241.322, 'text': "so definitely, this is a brute force solution and let's try to improve on it.", 'start': 2237.379, 'duration': 3.943}, {'end': 2248.825, 'text': 'in order to optimize this brute force solution, you have to apply something as a two pointer approach, Very simple.', 'start': 2241.322, 'duration': 7.503}, {'end': 2252.388, 'text': 'And then you will get the optimal approach.', 'start': 2249.766, 'duration': 2.622}, {'end': 2255.55, 'text': "Why did I say very simple? Let's think.", 'start': 2252.888, 'duration': 2.662}], 'summary': 'Iterating through set, time complexity: o(n log n), space complexity: o(n)', 'duration': 50.567, 'max_score': 2160.163, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/37E9ckMDdTk/pics/37E9ckMDdTk2160163.jpg'}], 'start': 1885.525, 'title': 'Array duplicates and unique set', 'summary': 'Addresses removing duplicates from a sorted array, emphasizing the need for in-place modification and defines a set data structure for optimizing the solution to achieve o(n) time complexity and o(n) space complexity.', 'chapters': [{'end': 2000.315, 'start': 1885.525, 'title': 'Remove duplicates from sorted array', 'summary': 'Addresses the problem of removing duplicates in place from a sorted array of integers, explaining the process of identifying and placing unique elements in the first few positions and returning the count of unique elements, emphasizing the need to modify the given array in-place.', 'duration': 114.79, 'highlights': ['The problem involves removing duplicates in place from a sorted array of integers, requiring the identification and placement of unique elements in the first few positions.', 'The solution should modify the given array in-place and return the count of unique elements present, emphasizing the need to refrain from creating a new array.', 'It is important to initially consider the brute force approach when tackling the problem of identifying unique elements in the array.']}, {'end': 2255.55, 'start': 2000.875, 'title': 'Define unique set data structure', 'summary': 'Explains the process of defining a set data structure, iterating through an array to insert unique elements into the set, and then using a two-pointer approach to optimize the brute force solution, achieving a time complexity of o(n) and space complexity of o(n).', 'duration': 254.675, 'highlights': ['The set data structure is defined and an array is iterated to insert unique elements into the set, resulting in a time complexity of O(n log n) for the brute force approach.', 'Using a two-pointer approach, an optimal solution is achieved with a time complexity of O(n) and a space complexity of O(n), which improves upon the brute force solution.', 'The set automatically stores elements in ascending order, making it efficient for checking and inserting unique elements with a space complexity of O(n).', 'The brute force approach has a time complexity of O(n log n) to insert into the set and a space complexity of O(n), assuming all elements are unique.']}], 'duration': 370.025, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/37E9ckMDdTk/pics/37E9ckMDdTk1885525.jpg', 'highlights': ['The set data structure optimizes the solution to achieve O(n) time complexity and O(n) space complexity', 'Using a two-pointer approach results in a time complexity of O(n) and a space complexity of O(n)', 'The problem involves removing duplicates in place from a sorted array of integers']}, {'end': 2596.976, 'segs': [{'end': 2283.643, 'src': 'embed', 'start': 2256.29, 'weight': 2, 'content': [{'end': 2261.674, 'text': 'So the array is sorted, right? And we know one thing for sure.', 'start': 2256.29, 'duration': 5.384}, {'end': 2263.655, 'text': 'First element is this.', 'start': 2262.474, 'duration': 1.181}, {'end': 2271.32, 'text': "And the next, like the first element will always be at its first place because that's unique in itself.", 'start': 2265.396, 'duration': 5.924}, {'end': 2279.12, 'text': 'The next place will be taken by someone who is not equivalent to one, because we are talking about unique, right?', 'start': 2272.096, 'duration': 7.024}, {'end': 2283.643, 'text': 'So the next element will be someone who will be not equivalent to this one.', 'start': 2279.601, 'duration': 4.042}], 'summary': 'Array is sorted, first element is unique, and next elements are not equivalent to one.', 'duration': 27.353, 'max_score': 2256.29, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/37E9ckMDdTk/pics/37E9ckMDdTk2256290.jpg'}, {'end': 2372.588, 'src': 'heatmap', 'start': 2345.035, 'weight': 0.716, 'content': [{'end': 2349.853, 'text': 'so i says you can take the place in front of me.', 'start': 2345.035, 'duration': 4.818}, {'end': 2352.355, 'text': 'So he will take the place here.', 'start': 2350.454, 'duration': 1.901}, {'end': 2356.638, 'text': 'And since he has taken the place here, the I pointer will move here.', 'start': 2353.055, 'duration': 3.583}, {'end': 2359.56, 'text': "I'll just erase this so that you have better clarity.", 'start': 2356.658, 'duration': 2.902}, {'end': 2360.74, 'text': 'I pointer will move here.', 'start': 2359.9, 'duration': 0.84}, {'end': 2363.062, 'text': 'Now, this is done.', 'start': 2361.221, 'duration': 1.841}, {'end': 2367.284, 'text': "So what you'll do is you'll move J.", 'start': 2364.423, 'duration': 2.861}, {'end': 2369.726, 'text': "And you'll say to, are you equivalent? He says yes.", 'start': 2367.284, 'duration': 2.442}, {'end': 2372.588, 'text': 'Not, no use.', 'start': 2370.726, 'duration': 1.862}], 'summary': 'I moved the pointer, then asked if equivalent, he said yes.', 'duration': 27.553, 'max_score': 2345.035, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/37E9ckMDdTk/pics/37E9ckMDdTk2345035.jpg'}, {'end': 2555.864, 'src': 'heatmap', 'start': 2421.44, 'weight': 0.743, 'content': [{'end': 2425.562, 'text': 'if i write the indexing 0, 1, 2 is standing at the second index.', 'start': 2421.44, 'duration': 4.122}, {'end': 2428.604, 'text': 'so what will be the size of the unique like?', 'start': 2425.562, 'duration': 3.042}, {'end': 2430.225, 'text': 'what will be the number of the unique elements?', 'start': 2428.604, 'duration': 1.621}, {'end': 2433.188, 'text': 'Definitely i plus 1..', 'start': 2431.025, 'duration': 2.163}, {'end': 2433.769, 'text': 'Quite simple.', 'start': 2433.188, 'duration': 0.581}, {'end': 2439.657, 'text': 'So if I have to write the code, how will the pseudocode look like? Can I say, I know one thing.', 'start': 2434.67, 'duration': 4.987}, {'end': 2442.621, 'text': 'The first unique element is i equal to c.', 'start': 2440.398, 'duration': 2.223}, {'end': 2447.484, 'text': "And then I know I'll start from 1 and I'll go on till end.", 'start': 2443.823, 'duration': 3.661}, {'end': 2448.304, 'text': "That's for sure.", 'start': 2447.524, 'duration': 0.78}, {'end': 2454.026, 'text': 'And I need to figure out someone who is not equivalent to my current one.', 'start': 2448.884, 'duration': 5.142}, {'end': 2461.648, 'text': 'If array of j is not equivalent to array of i.', 'start': 2455.406, 'duration': 6.242}, {'end': 2462.688, 'text': 'Who? Not equivalent.', 'start': 2461.648, 'duration': 1.04}, {'end': 2465.149, 'text': 'Take my front position.', 'start': 2463.308, 'duration': 1.841}, {'end': 2466.309, 'text': 'Take my front position.', 'start': 2465.209, 'duration': 1.1}, {'end': 2469.15, 'text': "So I'll be like, okay, let's give him the front position.", 'start': 2466.849, 'duration': 2.301}, {'end': 2470.825, 'text': 'Front position.', 'start': 2470.165, 'duration': 0.66}, {'end': 2472.907, 'text': 'I plus 1.', 'start': 2471.526, 'duration': 1.381}, {'end': 2474.307, 'text': 'Please take your front position.', 'start': 2472.907, 'duration': 1.4}, {'end': 2478.55, 'text': 'Once you have taken your front position, what will you do? Okay.', 'start': 2475.288, 'duration': 3.262}, {'end': 2480.351, 'text': 'Let me go to that front position.', 'start': 2479.03, 'duration': 1.321}, {'end': 2485.874, 'text': 'Because now if I go to the front position, if I go here, then only I can now do the future.', 'start': 2480.391, 'duration': 5.483}, {'end': 2489.036, 'text': 'I can get the next future element which is not equivalent.', 'start': 2486.594, 'duration': 2.442}, {'end': 2490.757, 'text': 'Got it? So this is how it will work.', 'start': 2489.196, 'duration': 1.561}, {'end': 2492.438, 'text': "So, I'll go to the front position.", 'start': 2491.457, 'duration': 0.981}, {'end': 2494.139, 'text': 'Done Very simple two-pointer.', 'start': 2492.558, 'duration': 1.581}, {'end': 2498.403, 'text': 'Once this for loop is complete, I know the size will be i plus 1.', 'start': 2494.68, 'duration': 3.723}, {'end': 2501.826, 'text': 'Because i at the end of the day will be here, which is 2.', 'start': 2498.403, 'duration': 3.423}, {'end': 2502.967, 'text': 'But the size will be 1 more.', 'start': 2501.826, 'duration': 1.141}, {'end': 2506.21, 'text': 'So, thereby, we will be returning i plus 1.', 'start': 2503.307, 'duration': 2.903}, {'end': 2509.032, 'text': 'This is how the two-pointer approach will look like.', 'start': 2506.21, 'duration': 2.822}, {'end': 2512.395, 'text': 'And if I have to ask you the optimals, time complexity.', 'start': 2509.272, 'duration': 3.123}, {'end': 2513.556, 'text': 'Simple one-pass.', 'start': 2512.855, 'duration': 0.701}, {'end': 2514.456, 'text': 'Big of n.', 'start': 2513.976, 'duration': 0.48}, {'end': 2516.158, 'text': 'space complexity.', 'start': 2515.177, 'duration': 0.981}, {'end': 2516.738, 'text': 'we got one.', 'start': 2516.158, 'duration': 0.58}, {'end': 2525.463, 'text': "why? because one pass and you're doing everything in that particular array as it was being asked in the like.", 'start': 2516.738, 'duration': 8.725}, {'end': 2530.265, 'text': "if you remember the problem statement, it's stated in place and that is being done.", 'start': 2525.463, 'duration': 4.802}, {'end': 2532.427, 'text': 'this is the optimal solution for this problem.', 'start': 2530.265, 'duration': 2.162}, {'end': 2537.509, 'text': "just in case you want to submit the problem, the problem link will be in the description and i've written the same code.", 'start': 2532.427, 'duration': 5.082}, {'end': 2541.051, 'text': "now let's quickly submit this and see if it is running fine or not.", 'start': 2537.509, 'duration': 3.542}, {'end': 2541.892, 'text': 'yeah, it does run.', 'start': 2541.051, 'duration': 0.841}, {'end': 2547.476, 'text': "so with this i can say that i've completed the fourth problem as well.", 'start': 2542.452, 'duration': 5.024}, {'end': 2550.879, 'text': 'so for this video, we will be keeping it till here,', 'start': 2547.476, 'duration': 3.403}, {'end': 2555.864, 'text': "because i don't want to solve a lot of problems and make the video long because that might scare you.", 'start': 2550.879, 'duration': 4.985}], 'summary': 'Using two-pointer approach to find unique elements, returning i+1, time complexity o(n), space complexity o(1)', 'duration': 134.424, 'max_score': 2421.44, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/37E9ckMDdTk/pics/37E9ckMDdTk2421440.jpg'}, {'end': 2525.463, 'src': 'embed', 'start': 2498.403, 'weight': 0, 'content': [{'end': 2501.826, 'text': 'Because i at the end of the day will be here, which is 2.', 'start': 2498.403, 'duration': 3.423}, {'end': 2502.967, 'text': 'But the size will be 1 more.', 'start': 2501.826, 'duration': 1.141}, {'end': 2506.21, 'text': 'So, thereby, we will be returning i plus 1.', 'start': 2503.307, 'duration': 2.903}, {'end': 2509.032, 'text': 'This is how the two-pointer approach will look like.', 'start': 2506.21, 'duration': 2.822}, {'end': 2512.395, 'text': 'And if I have to ask you the optimals, time complexity.', 'start': 2509.272, 'duration': 3.123}, {'end': 2513.556, 'text': 'Simple one-pass.', 'start': 2512.855, 'duration': 0.701}, {'end': 2514.456, 'text': 'Big of n.', 'start': 2513.976, 'duration': 0.48}, {'end': 2516.158, 'text': 'space complexity.', 'start': 2515.177, 'duration': 0.981}, {'end': 2516.738, 'text': 'we got one.', 'start': 2516.158, 'duration': 0.58}, {'end': 2525.463, 'text': "why? because one pass and you're doing everything in that particular array as it was being asked in the like.", 'start': 2516.738, 'duration': 8.725}], 'summary': 'Two-pointer approach returns i+1, with time complexity o(n) and space complexity o(1).', 'duration': 27.06, 'max_score': 2498.403, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/37E9ckMDdTk/pics/37E9ckMDdTk2498403.jpg'}, {'end': 2596.976, 'src': 'embed', 'start': 2577.009, 'weight': 4, 'content': [{'end': 2583.651, 'text': 'please please consider subscribing to us, because that is the only thing that keeps you motivated to make these kind of content.', 'start': 2577.009, 'duration': 6.642}, {'end': 2590.794, 'text': "and, yeah, hit that like button and, and if you haven't followed me on instagram, the id is over here do follow me on instagram,", 'start': 2583.651, 'duration': 7.143}, {'end': 2594.875, 'text': "linkedin and whatever social media links you'll find in the description.", 'start': 2590.794, 'duration': 4.081}, {'end': 2596.155, 'text': "with this i'll be wrapping up this video.", 'start': 2594.875, 'duration': 1.28}, {'end': 2596.976, 'text': "let's be in some other video.", 'start': 2596.155, 'duration': 0.821}], 'summary': 'Encourages subscription for motivation, requests likes, and shares social media links.', 'duration': 19.967, 'max_score': 2577.009, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/37E9ckMDdTk/pics/37E9ckMDdTk2577009.jpg'}], 'start': 2256.29, 'title': 'Array sorting logic and two-pointer approach', 'summary': 'Explains the logic of sorting an array based on unique elements, and a two-pointer approach for finding unique elements with time complexity of o(n) and space complexity of o(1), concluding with a call to action for viewers.', 'chapters': [{'end': 2305.978, 'start': 2256.29, 'title': 'Array sorting logic', 'summary': 'Explains the logic of sorting an array based on unique elements, where the first element is always unique, and subsequent elements are placed based on their uniqueness, resulting in a sorted array.', 'duration': 49.688, 'highlights': ['The first element of the sorted array is always unique, and subsequent elements are placed based on their uniqueness, ensuring a sorted array.', 'The process involves checking for elements that are not equivalent to the previous one and placing them in the next index, resulting in a sorted array.']}, {'end': 2596.976, 'start': 2305.978, 'title': 'Two-pointer approach for finding unique elements', 'summary': 'Explains a two-pointer approach for finding unique elements in an array, showcasing an optimal solution with time complexity of o(n) and space complexity of o(1), and concludes with a call to action for viewers.', 'duration': 290.998, 'highlights': ['The two-pointer approach is used to find unique elements in an array, with the algorithm showcasing an optimal time complexity of O(n) and space complexity of O(1).', "The chapter concludes with a call to action for viewers, encouraging them to comment 'understood', subscribe to the channel, and follow the creator on social media.", 'The approach employs a simple one-pass algorithm with time complexity of O(n) and space complexity of O(1), providing an optimal solution for the problem at hand.']}], 'duration': 340.686, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/37E9ckMDdTk/pics/37E9ckMDdTk2256290.jpg', 'highlights': ['The two-pointer approach is used to find unique elements in an array, with the algorithm showcasing an optimal time complexity of O(n) and space complexity of O(1).', 'The approach employs a simple one-pass algorithm with time complexity of O(n) and space complexity of O(1), providing an optimal solution for the problem at hand.', 'The first element of the sorted array is always unique, and subsequent elements are placed based on their uniqueness, ensuring a sorted array.', 'The process involves checking for elements that are not equivalent to the previous one and placing them in the next index, resulting in a sorted array.', "The chapter concludes with a call to action for viewers, encouraging them to comment 'understood', subscribe to the channel, and follow the creator on social media."]}], 'highlights': ['The course promises to solve 400+ problems and offers 456 modules, ensuring a comprehensive understanding of data structures and algorithms.', 'The optimal solution for finding the largest element in an array involves iterating through the array once, resulting in a time complexity of O(n), which is much better than the brute force solution involving sorting with a time complexity of O(n log n).', 'The method of checking if an array is sorted in non-descending order includes comparing each element with the previous one and returning true if the entire iteration is completed without finding any unsorted pair, with a time complexity of O(n).', 'The set data structure optimizes the solution to achieve O(n) time complexity and O(n) space complexity', 'The two-pointer approach is used to find unique elements in an array, with the algorithm showcasing an optimal time complexity of O(n) and space complexity of O(1).']}