https://python-hub.com/lets-face-dsa-together/
Here’s the question link on LeetCode 442. Find All Duplicates in an Array: https://leetcode.com/problems/find-all-duplicates-in-an-array/description Brute Force - O(n^2)Better O(n log n)Optimal O(n)Code lines explained Brute Force - O(n^2) The simplest…
Here’s the question link on LeetCode 15. 3Sum: https://leetcode.com/problems/3sum/description Brute Force O(n³)Better O(n²) Sorting + Hash SetOptimal O(n²) Two Pointers Brute Force O(n³) The simplest approach is to try every…
8. String to Integer (atoi) 8. String to Integer (atoi) 8. String to Integer (atoi) 8. String to Integer (atoi) Here’s the question link on LeetCode 8. String to Integer…
Here’s the question link on LeetCode 796. Rotate String:- https://leetcode.com/problems/rotate-string/description Optimal: Simulate Every Rotation Optimal: Simulate Every Rotation We can simply try every possible rotation of the string and check…
Here’s the question link on LeetCode 567. Permutation in String:- https://leetcode.com/problems/permutation-in-string/description Brute Force: Generate and Check Every SubstringOptimal: Sliding Window + Frequency ArrayHow does the window work? Brute Force: Generate…