fa
Feedback
DataStructure and Algorithms Solutions with Supercool 💯

DataStructure and Algorithms Solutions with Supercool 💯

رفتن به کانال در Telegram

DSA with supercool For paid projects:- Email :- supercool7151@gmail.com Follow me on social media https://linktr.ee/codemaking

نمایش بیشتر
643
مشترکین
اطلاعاتی وجود ندارد24 ساعت
اطلاعاتی وجود ندارد7 روز
اطلاعاتی وجود ندارد30 روز
آرشیو پست ها
Emailing VSCode Cheatsheet(1).pdf

Merry Christmas guys 💕⛄

😍 300+ courses are available for free 🥳🥳 Link:- https://coursefolder.net/live-free-udemy-coupon.php Enroll now.

React Native me applications banana hai guys
Anonymous voting

React native me applications banana
Anonymous voting

Problem Of The Day "Zero Sum Subarrays" Solve the problem to win points You are given an array arr[] of size n. Find the total count of sub-arrays having their sum equal to 0. Example 1: Input: n = 6 arr[] = {0,0,5,5,0,0} Output: 6 Explanation: The 6 subarrays are [0], [0], [0], [0], [0,0], and [0,0]. Example 2: Input: n = 10 arr[] = {6,-1,-3,4,-2,2,4,6,-12,-7} Output: 4 Explanation: The 4 subarrays are [-1 -3 4] [-2 2], [2 4 6 -12], and [-1 -3 4 -2 2] Your Task: You don't need to read input or print anything. Complete the function findSubarray() that takes the array arr and its size n as input parameters and returns the total number of sub-arrays with 0 sum. Expected Time Complexity: O(n*log(n)) Expected Auxilliary Space: O(n) Solve the problem

DSA Basics se suru kru ya phir jaisa chal raha hai theeek hai
Anonymous voting

Problem Of The Day "Absolute List Sorting" Solve the problem to win points Given a linked list of N nodes, sorted in ascending order based on the absolute values of its data,i.e. negative values are considered as positive ones. Sort the linked list in ascending order according to the actual values, and consider negative numbers as negative and positive numbers as positive. Example 1: Input: List: 1, -2, -3, 4, -5 Output: List: -5, -3, -2, 1, 4 Explanation: Actual sorted order of {1, -2, -3, 4, -5} is {-5, -3, -2, 1, 4} Example 2: Input: List: 5, -10 Output: List: -10, 5 Explanation: Actual sorted order of {5, -10} is {5, 10} Your Task: You don't need to read or print anyhting. Your Task is to comple the function sortList() which takes the head of the Linked List as input parameter and sort the list in ascending order and return the head pointer of the sorted list. Expected Time Complexity: O(N) Expected Space Complexity: O(1) Solve the problem

Solution is out #include <iostream> #include <vector> #include <algorithm> using namespace std;   // Function to find the total number of 1's in a sorted binary array int count(vector<int> const &nums) {     return upper_bound(nums.begin(), nums.end(), 1)             - lower_bound(nums.begin(), nums.end(), 1); }   int main() {     vector<int> nums = { 0, 0, 0, 0, 1, 1, 1 };       cout << "The total number of 1's present is " << count(nums);       return 0; }

Problem Of The Day "A difference of values and indexes" Solve the problem to win points Given an unsorted array arr[ ] of size n, you need to find the maximum difference of absolute values of elements and indexes, i.e., for i <= j, calculate maximum of | arr[ i ] - arr[ j ] | + | i - j |. Example 1: Input : n = 3 arr[ ] = {1, 3, -1} Output: 5 Explanation: Maximum difference comes from indexes 1, 2 i.e | 3 - (-1) | + | 1 - 2 | = 5 Example 2: Input : n = 4 arr[ ] = {5, 9, 2, 6} Output: 8 Explanation: Maximum difference comes from indexes 1, 2 i.e | 9 - 2 | + | 1 - 2 | = 8 Your Task: This is a function problem. The input is already taken care of by the driver code. You only need to complete the function maxDistance() that takes an array (arr), sizeOfArray (n), and return the maximum difference as given in the question. The driver code takes care of the printing. Expected Time Complexity: O(n). Expected Auxiliary Space: O(1). Solve the problem

#1 -> Given a sorted Array Which Only Contains 0's and 1's efficiently count the total number of 1's in it Input :- A = [0,0,0,0,1,1,1] Output :- 3

Update : Important resources thread 📌 Low Level Design https://www.linkedin.com/posts/rahulthecoder_lowleveldesign-activity-7009768659019534336-DPbE? Complete DSA Guide 💯 https://www.linkedin.com/posts/rahulthecoder_completedsaguide-activity-6926082761057284096-1e8E Leetcode Most Asked Questions Leetcode Most Asked Questions with Solutions 🎁 https://www.linkedin.com/posts/rahulthecoder_leetcodemostaskedquestions-activity-6938179174578696193-GO8u? Do share with your friends 😊👍 JS Pdf https://www.linkedin.com/posts/rahulthecoder_sqlcheatsheet-activity-6936227306977796096-UwhU DSA Problems List ❤️ https://www.linkedin.com/posts/rahulthecoder_dsaproblemlist-activity-6923955059869265920-1H_a DP Part 1 https://www.linkedin.com/posts/rahulthecoder_part1dynamicprogramming-activity-6924321084007686144-jBal Coding Website List https://www.linkedin.com/posts/rahulthecoder_coding-hackerrank-codechef-activity-6924729947974483968-W9A3 Graph Data Structure https://www.linkedin.com/posts/rahulthecoder_graphdatastructurepart1-activity-6924962519832739840-Tb-y Shell Scripting Notes ♥️ https://www.linkedin.com/posts/rahulthecoder_shellscriptingnotes-activity-6925431934479138816-YAD_ DSA Cheat CODE Link - https://www.linkedin.com/posts/rahulthecoder_cheatcodebookbygfg-activity-6922932484225527808-TEEo? System Design Interview TextBook https://www.linkedin.com/posts/rahulthecoder_systemdesigninterviewbook-activity-6927111173674807297-6qI2 Namaste Javascript PDF 🙏 https://www.linkedin.com/posts/rahulthecoder_namastejavascriptnotes-activity-6927616995672616960-yX1I Best Channels for DSA - Topic Wise Link - https://www.linkedin.com/posts/rahulthecoder_dsatopicwiseyoutubechannels-activity-6922557114779328512-GODr? Java Interview Questions List Link - https://www.linkedin.com/posts/rahulthecoder_javainterviewquestions-activity-6920929449588789248-GZL8? React JS Guide Link - https://www.linkedin.com/posts/rahulthecoder_reactjsguide-activity-6920580071007145984-RtLO? Kubernetes Link - https://www.linkedin.com/posts/rahulthecoder_what-is-kubernetes-activity-6919573804289589248-yNPc? React JS Cheatsheet Link - https://www.linkedin.com/posts/rahulthecoder_reactjscheatsheet-activity-6918885571515883520-iT8x? Recursion & Backtracking Notes Link - https://www.linkedin.com/posts/rahulthecoder_recursionbacktrackingnotes-activity-6918444044536750080-ClNP? Alternatives of FAANG Link - https://www.linkedin.com/posts/rahulthecoder_letssupportfreshers-jobsforfreshers-offcampusjobs4u-activity-6914869004088090624-Mqoy? Complexities Cheatsheet Link - https://www.linkedin.com/posts/rahulthecoder_timecomplexitiescheatshet-activity-6913195945560080384-oXQG? Linked List Revision Notes Link - https://www.linkedin.com/posts/rahulthecoder_linkedlistrevisionnotes-activity-6923615751278862336-OlIK?

```def readN(n): s = "" while n > 0: chunk = read7(min(n, 7)) if not chunk: return s s += chunk n -= len(chunk) return s```
```def readN(n): s = "" while n > 0: chunk = read7(min(n, 7)) if not chunk: return s s += chunk n -= len(chunk) return s```

```def edit_distance(str1, str2): n = len(str1) m = len(str2) dp = [[0 for _ in range(m + 1)] for _ in range(n + 1)] for i in
```def edit_distance(str1, str2): n = len(str1) m = len(str2) dp = [[0 for _ in range(m + 1)] for _ in range(n + 1)] for i in range(n + 1): for j in range(m + 1): if i == 0: dp[i][j] = j elif j == 0: dp[i][j] = i else: dp[i][j] = min(dp[i-1][j] + 1, dp[i][j-1] + 1, dp[i-1][j-1] + (str1[i-1] != str2[j-1])) return dp[n][m] print(edit_distance("kitten", "sitting")) ```

```def split_into_palindromes(s): # base case: if the string is empty, return an empty list if not s: return [] # splitting t
```def split_into_palindromes(s): # base case: if the string is empty, return an empty list if not s: return [] # splitting the string at each position for i in range(1, len(s) + 1): # if the prefix is a palindrome, recursively split the remainder of the string if s[:i] == s[:i][::-1]: result = split_into_palindromes(s[i:]) # if the remainder of the string can be split into palindromes, return the prefix plus the result if result is not None: return [s[:i]] + result # if not possible, return None return None # test print(split_into_palindromes("racecarannakayak")) # ["racecar", "anna", "kayak"] print(split_into_palindromes("abc")) # ["a", "b", "c"]```

```def max_heap_ways(n: int, nums: List[int]) -> int: # First, sort the list of integers in descending order nums = sorted(nu
```def max_heap_ways(n: int, nums: List[int]) -> int: # First, sort the list of integers in descending order nums = sorted(nums, reverse=True) # Initialize a variable to store the number of ways ways = 0 # Loop through the list of integers, starting from the first element for i in range(n): # If the current integer is larger than the maximum possible number of children # that a node can have in a max heap, there is no way to create a max heap # using the current integer as the root, so we can break out of the loop if nums[i] > (n - i - 1) // 2: break # Otherwise, increment the number of ways by 1 ways += 1 return ways```

```def smallest_string(string, k): smallest = min(string[:k]) new_string = string[:string.index(smallest)] + string[string.in
```def smallest_string(string, k): smallest = min(string[:k]) new_string = string[:string.index(smallest)] + string[string.index(smallest) + 1:] + smallest return new_string print(smallest_string("daily", 1))```

‘’’ // C++ Program to print a matrix spirally #include <bits/stdc++.h> using namespace std; #define R 4 #define C 4 void spiralPrint(int m, int n, int a[R][C]) { int i, k = 0, l = 0; /* k - starting row index m - ending row index l - starting column index n - ending column index i - iterator */ while (k < m && l < n) { /* Print the first row from the remaining rows */ for (i = l; i < n; ++i) { cout << a[k][i] << " "; } k++; /* Print the last column from the remaining columns */ for (i = k; i < m; ++i) { cout << a[i][n - 1] << " "; } n--; /* Print the last row from the remaining rows */ if (k < m) { for (i = n - 1; i >= l; --i) { cout << a[m - 1][i] << " "; } m--; } /* Print the first column from the remaining columns */ if (l < n) { for (i = m - 1; i >= k; --i) { cout << a[i][l] << " "; } l++; } } }’’’