- 96
- 8 264
The CodeBreakz Show
India
Приєднався 30 тра 2023
Follow the CodeWithEase channel on WhatsApp:
whatsapp.com/channel/0029VaUDt2Q23n3kqYyoP43U
whatsapp.com/channel/0029VaUDt2Q23n3kqYyoP43U
539. Minimum Time Difference | 2 Approach | 🔥🎯PYTHON 🔥🎯 |Leetcode POTD
539. Minimum Time Difference | 2 Approach | 🔥🎯PYTHON 🔥🎯 |Leetcode POTD
Github Code Link : Python :
github.com/Prathameshghod/539.-Minimum-Time-Difference/blob/main/539.%20Minimum%20Time%20Difference
Leetcode Problem of the day
Donation Form Link:
docs.google.com/forms/d/e/1FAIpQLScyIg4N2ytKxKuqmU96636GZpdQy7PxvP35LghFcrehukueUQ/viewform
Let's Connect
Instagram 📷:
the_codebreakz_show?igsh=MTAzMWk0NHhoYzZnMg==
Follow the CodeBreakz channel on WhatsApp:
whatsapp.com/channel/0029VaUDt2Q23n3kqYyoP43U
Amazon Links for buying items:
stylus : amzn.to/4csY0cK
stylus 2: amzn.to/3zvCrcU
amzn.to/45UF0kH
Xiaomi Pad 6: amzn.to/3XONDv8
Lenovo M9 Tab: amzn.to/4cMkFR4
Samsung Galaxy Tab A9: amzn.to/45QHv7D
Apple 2023 MacBook Pro:
amzn.to/3W8gqtn
👉 Boom Arm
amazon.yt.cash/fi7j4
👉 Acoustic Guitar
amazon.yt.cash/y33wl
👉 Condenser Microphone
amazon.yt.cash/hcp22
👉 Vinyl Storage
amazon.yt.cash/xwvfd
👉 Stand-Up Guide
amazon.yt.cash/k3ylo
Welcome to The CodeBreakz Show,
your ultimate destination for all things coding!
Whether you're a beginner just starting your programming journey or an experienced developer looking to expand your skills, we have something for everyone. Our channel features a wide variety of content, including:
Tutorials: Step-by-step guides to help you master different programming languages and technologies.
Live Coding Sessions: Watch and learn as we tackle real-world projects and solve coding challenges in real-time.
Project Builds: Follow along with detailed walkthroughs of exciting projects to enhance your portfolio.
Tips & Tricks: Quick tips and best practices to improve your coding efficiency and productivity.
We cover an extensive range of programming languages and frameworks, from Python and JavaScript to more specialized tools like TensorFlow and React.
Our mission is to make coding accessible and enjoyable for everyone. Join our community of learners and developers, and start building your coding skills today!Don’t forget to like, subscribe, and hit the bell icon to stay updated with our latest videos.
Happy coding!
#maths #leetcodepython
#codesolution #programminglanguage #education #codechefsolution
#programmingsolution #coding #leetcode #pythonprogramming #codechefsolution #codesolution #programming #leetcodepythonsolution #gfg #gfgsolutions
Github Code Link : Python :
github.com/Prathameshghod/539.-Minimum-Time-Difference/blob/main/539.%20Minimum%20Time%20Difference
Leetcode Problem of the day
Donation Form Link:
docs.google.com/forms/d/e/1FAIpQLScyIg4N2ytKxKuqmU96636GZpdQy7PxvP35LghFcrehukueUQ/viewform
Let's Connect
Instagram 📷:
the_codebreakz_show?igsh=MTAzMWk0NHhoYzZnMg==
Follow the CodeBreakz channel on WhatsApp:
whatsapp.com/channel/0029VaUDt2Q23n3kqYyoP43U
Amazon Links for buying items:
stylus : amzn.to/4csY0cK
stylus 2: amzn.to/3zvCrcU
amzn.to/45UF0kH
Xiaomi Pad 6: amzn.to/3XONDv8
Lenovo M9 Tab: amzn.to/4cMkFR4
Samsung Galaxy Tab A9: amzn.to/45QHv7D
Apple 2023 MacBook Pro:
amzn.to/3W8gqtn
👉 Boom Arm
amazon.yt.cash/fi7j4
👉 Acoustic Guitar
amazon.yt.cash/y33wl
👉 Condenser Microphone
amazon.yt.cash/hcp22
👉 Vinyl Storage
amazon.yt.cash/xwvfd
👉 Stand-Up Guide
amazon.yt.cash/k3ylo
Welcome to The CodeBreakz Show,
your ultimate destination for all things coding!
Whether you're a beginner just starting your programming journey or an experienced developer looking to expand your skills, we have something for everyone. Our channel features a wide variety of content, including:
Tutorials: Step-by-step guides to help you master different programming languages and technologies.
Live Coding Sessions: Watch and learn as we tackle real-world projects and solve coding challenges in real-time.
Project Builds: Follow along with detailed walkthroughs of exciting projects to enhance your portfolio.
Tips & Tricks: Quick tips and best practices to improve your coding efficiency and productivity.
We cover an extensive range of programming languages and frameworks, from Python and JavaScript to more specialized tools like TensorFlow and React.
Our mission is to make coding accessible and enjoyable for everyone. Join our community of learners and developers, and start building your coding skills today!Don’t forget to like, subscribe, and hit the bell icon to stay updated with our latest videos.
Happy coding!
#maths #leetcodepython
#codesolution #programminglanguage #education #codechefsolution
#programmingsolution #coding #leetcode #pythonprogramming #codechefsolution #codesolution #programming #leetcodepythonsolution #gfg #gfgsolutions
Переглядів: 33
Відео
Leetcode Weekly Contest 415 Solution |Two Sneaky Numbers of Digitville | Maximum Multiplication Scor
Переглядів 587 годин тому
Leetcode Weekly Contest 415 Solution | 3289. The Two Sneaky Numbers of Digitville | Maximum Energy Boost from Two Drinks 3289. The Two Sneaky Numbers of Digitville 3290. Maximum Multiplication Score 🔥🎯PYTHON VS C 🔥🎯 Github Code Link : Python github.com/Prathameshghod/Leetcode-Weekly-Contest-415/blob/main/Leetcode Contest 415 Donation Form Link: docs.google.com/forms/d/e/1FAIpQLScyIg4N2ytKxKuqmU...
947. Most Stones Removed with Same Row or Column | Simple DFS | 🔥🎯PYTHON 🔥🎯 |Leetcode POTD
Переглядів 2914 днів тому
947. Most Stones Removed with Same Row or Column | Simple DFS | 🔥🎯PYTHON 🔥🎯 |Leetcode POTD Github Code Link : Python : github.com/Prathameshghod/947.-Most-Stones-Removed-with-Same-Row-or-Column/blob/main/947. Most Stones Removed with Same Row or Column Leetcode Problem of the day Donation Form Link: docs.google.com/forms/d/e/1FAIpQLScyIg4N2ytKxKuqmU96636GZpdQy7PxvP35LghFcrehukueUQ/viewform Let'...
476. Number Complement | Two Approaches | Simulation | Bit Masking 🔥🎯PYTHON 🔥🎯 |Leetcode POTD
Переглядів 3621 день тому
476. Number Complement | Two Approaches | Simulation | Bit Masking 🔥🎯PYTHON 🔥🎯 |Leetcode POTD Github Code Link : Python : github.com/Prathameshghod/-Code-Code-Accepted-Tes476.-Number-Complement/blob/main/476. Number Complement Leetcode Problem of the day Donation Form Link: docs.google.com/forms/d/e/1FAIpQLScyIg4N2ytKxKuqmU96636GZpdQy7PxvP35LghFcrehukueUQ/viewform Let's Connect Instagram 📷: ins...
264. Ugly Number II Python and C++| 🔥🎯PYTHON VS C++ 🔥🎯 |Leetcode POTD
Переглядів 4428 днів тому
264. Ugly Number II Python and C | 🔥🎯PYTHON VS C 🔥🎯 |Leetcode POTD Github Code Link : C and Python : github.com/Prathameshghod/264.-Ugly-Number-II/blob/main/264. Ugly Number II Leetcode Problem of the day Donation Form Link: docs.google.com/forms/d/e/1FAIpQLScyIg4N2ytKxKuqmU96636GZpdQy7PxvP35LghFcrehukueUQ/viewform Let's Connect Instagram 📷: the_codebreakz_show?igsh=MTAzMWk0NHhoYz...
Leetcode Weekly Contest 411 Solution | Count Substring That Satisfy K-Constraints I | Maximum Energy
Переглядів 9728 днів тому
Leetcode Weekly Contest 411 Solution | Count Substring That Satisfy K-Constraints I | Maximum Energy Boost from Two Drinks 3258.Count Substring That Satisfy K-Constraints I 3259. Maximum Energy Boost from Two Drinks 🔥🎯PYTHON VS C 🔥🎯 Github Code Link : C and Python github.com/Prathameshghod/Leetcode-Weekly-Contest-411/blob/main/Leetcode Weekly Contest 411 Donation Form Link: docs.google.com/form...
Leetcode Biweekly Contest 137 Contest Solution | Find the Power of K-Size Subarrays I and II
Переглядів 62Місяць тому
Leetcode Biweekly Contest 137 Contest Solution 3254. Find the Power of K-Size Subarrays I 3255. Find the Power of K-Size Subarrays II 🔥🎯PYTHON VS C 🔥🎯 Github Code Link : C and Python github.com/Prathameshghod/Leetcode-Bieekly-Contest-137/blob/main/Leetcode Biweekly Contest 137 Donation Form Link: docs.google.com/forms/d/e/1FAIpQLScyIg4N2ytKxKuqmU96636GZpdQy7PxvP35LghFcrehukueUQ/viewform Let's C...
860. Lemonade Change Python and C++| 🔥🎯PYTHON VS C++ 🔥🎯 |Leetcode POTD
Переглядів 28Місяць тому
860. Lemonade Change Python and C | 🔥🎯PYTHON VS C 🔥🎯 |Leetcode POTD Github Code Link : C and Python github.com/Prathameshghod/860.-Lemonade-Change/blob/main/860. Lemonade Change Leetcode Problem of the day Donation Form Link: docs.google.com/forms/d/e/1FAIpQLScyIg4N2ytKxKuqmU96636GZpdQy7PxvP35LghFcrehukueUQ/viewform Let's Connect Instagram 📷: the_codebreakz_show?igsh=MTAzMWk0NHhoY...
Codechef Starters 147 Explanat | Independence Day 101 | Truth Tellers and Liars 101 | Non-Primes 101
Переглядів 64Місяць тому
Codechef Starters 147 Explanation | Independence Day 101 | Truth Tellers and Liars 101 | Non-Primes 101 | Shortest Distances 101 Github Link of code ( All in One ) : github.com/Prathameshghod/Codechef-Starters-147/blob/main/Codechef Starters 147 Independence Day 101 Truth Tellers and Liars 101 Non-Primes 101 Shortest Distances 101 docs.google.com/forms/d/e/1FAIpQLScyIg4N2ytKxKuqmU96636GZpdQy7Px...
719. Find K-th Smallest Pair Distance Python and C++| 🔥🎯PYTHON VS C++ 🔥🎯 |Leetcode POTD
Переглядів 36Місяць тому
719. Find K-th Smallest Pair Distance Python and C | 🔥🎯PYTHON VS C 🔥🎯 |Leetcode POTD Github Code Link : C and Python github.com/Prathameshghod/719.-Find-K-th-Smallest-Pair-Distance/blob/main/719. Find K-th Smallest Pair Distance Leetcode Problem of the day Donation Form Link: docs.google.com/forms/d/e/1FAIpQLScyIg4N2ytKxKuqmU96636GZpdQy7PxvP35LghFcrehukueUQ/viewform Let's Connect Instagram 📷: i...
703. Kth Largest Element in a Stream Python and C++| 🔥🎯PYTHON VS C++ 🔥🎯 |Leetcode POTD
Переглядів 24Місяць тому
703. Kth Largest Element in a Stream Python and C | 🔥🎯PYTHON VS C 🔥🎯 |Leetcode POTD Github Code Link : C and Python github.com/Prathameshghod/703.-Kth-Largest-Element-in-a-Stream/blob/main/703. Kth Largest Element in a Stream Leetcode Problem of the day Donation Form Link: docs.google.com/forms/d/e/1FAIpQLScyIg4N2ytKxKuqmU96636GZpdQy7PxvP35LghFcrehukueUQ/viewform Let's Connect Instagram 📷: inst...
1568. Minimum Number of Days to Disconnect Island Python and C++| 🔥🎯PYTHON VS C++ 🔥🎯 |Leetcode POTD
Переглядів 49Місяць тому
1568. Minimum Number of Days to Disconnect Island Python and C | 🔥🎯PYTHON VS C 🔥🎯 |Leetcode POTD Github Code Link : C and Python github.com/Prathameshghod/1568.-Minimum-Number-of-Days-to-Disconnect-Island/blob/main/1568. Minimum Number of Days to Disconnect Island Leetcode Problem of the day Donation Form Link: docs.google.com/forms/d/e/1FAIpQLScyIg4N2ytKxKuqmU96636GZpdQy7PxvP35LghFcrehukueUQ/v...
885. Spiral Matrix III Python and C++| 🔥🎯PYTHON VS C++ 🔥🎯 |Leetcode POTD
Переглядів 102Місяць тому
885. Spiral Matrix III Python and C | 🔥🎯PYTHON VS C 🔥🎯 |Leetcode POTD Github Code Link : C and Python github.com/Prathameshghod/885.-Spiral-Matrix-III/blob/main/885. Spiral Matrix III Leetcode Problem of the day Donation Form Link: docs.google.com/forms/d/e/1FAIpQLScyIg4N2ytKxKuqmU96636GZpdQy7PxvP35LghFcrehukueUQ/viewform Let's Connect Instagram 📷: the_codebreakz_show?igsh=MTAzMWk...
Codechef Starters 146,Contest Explanation | No Winner | Knockout Tournament | Permutation Constructi
Переглядів 129Місяць тому
Codechef Starters 146,Contest Explanation | No Winner | Knockout Tournament | Permutation Construction Codechef Starters 146 Contest Explanation | Python Explanation Donation Form Link: docs.google.com/forms/d/e/1FAIpQLScyIg4N2ytKxKuqmU96636GZpdQy7PxvP35LghFcrehukueUQ/viewform Let's Connect Instagram 📷: urs_p_ubunt...instagram.comurs_p_ubuntu?igsh=M2NuOXVub3RxNTl6 Follow the Code...
3016. Minimum Number of Pushes to Type Word II Python and C++| 🔥🎯PYTHON VS C++ 🔥🎯 |Leetcode POTD
Переглядів 76Місяць тому
3016. Minimum Number of Pushes to Type Word II Python and C | 🔥🎯PYTHON VS C 🔥🎯 |Leetcode POTD Leetcode Problem of the day Donation Form Link: docs.google.com/forms/d/e/1FAIpQLScyIg4N2ytKxKuqmU96636GZpdQy7PxvP35LghFcrehukueUQ/viewform Let's Connect Instagram 📷: urs_p_ubunt...instagram.comurs_p_ubuntu?igsh=M2NuOXVub3RxNTl6 Follow the CodeBreakz channel on WhatsApp: whatsapp.com/cha...
2053. Kth Distinct String in an Array Python | 🔥🎯 PYTHON 🔥🎯 |Leetcode Problem of the day
Переглядів 37Місяць тому
2053. Kth Distinct String in an Array Python | 🔥🎯 PYTHON 🔥🎯 |Leetcode Problem of the day
Leetcode Biweekly Contest 136 Explanation in Python | Problem A and B Python Full Explanation
Переглядів 36Місяць тому
Leetcode Biweekly Contest 136 Explanation in Python | Problem A and B Python Full Explanation
1460. Make Two Arrays Equal by Reversing Subarrays Python and C++| 🔥🎯PYTHON VS C++ 🔥🎯 |Leetcode POTD
Переглядів 14Місяць тому
1460. Make Two Arrays Equal by Reversing Subarrays Python and C | 🔥🎯PYTHON VS C 🔥🎯 |Leetcode POTD
2678. Number of Senior Citizens Python and C++ | 🔥🎯PYTHON VS C++ 🔥🎯 | Leetcode POTD
Переглядів 52Місяць тому
2678. Number of Senior Citizens Python and C | 🔥🎯PYTHON VS C 🔥🎯 | Leetcode POTD
Codechef Starters 145 Contest Explanation | Gun Master | Make My Array Equal | Make Bob Win Python
Переглядів 578Місяць тому
Codechef Starters 145 Contest Explanation | Gun Master | Make My Array Equal | Make Bob Win Python
1105. Filling Bookcase Shelves Python | 🔥🎯PYTHON 🔥🎯 | Leetcode Problem of the day
Переглядів 26Місяць тому
1105. Filling Bookcase Shelves Python | 🔥🎯PYTHON 🔥🎯 | Leetcode Problem of the day
1653. Minimum Deletions to Make String Balanced Python and C++ | 🔥🎯PYTHON VS C++ 🔥🎯 | Leetcode POTD
Переглядів 29Місяць тому
1653. Minimum Deletions to Make String Balanced Python and C | 🔥🎯PYTHON VS C 🔥🎯 | Leetcode POTD
1395. Count Number Of Teams Python | 🔥🎯PYTHON 🔥🎯 | Leetcode Problem of the day
Переглядів 25Місяць тому
1395. Count Number Of Teams Python | 🔥🎯PYTHON 🔥🎯 | Leetcode Problem of the day
Leetcode Weekly Contest 408 Detailed Explanation in C++ | C++ | Python | Promblem A, B
Переглядів 27Місяць тому
Leetcode Weekly Contest 408 Detailed Explanation in C | C | Python | Promblem A, B
1636. Sort Array by Increasing Frequency Python and C++ | 🔥🎯PYTHON VS C++ 🔥🎯 | Leetcode POTD
Переглядів 49Місяць тому
1636. Sort Array by Increasing Frequency Python and C | 🔥🎯PYTHON VS C 🔥🎯 | Leetcode POTD
2418. Sort the People Python and C++ | 🔥🎯PYTHON VS C++ 🔥🎯 | Leetcode Problem of the Day
Переглядів 24Місяць тому
2418. Sort the People Python and C | 🔥🎯PYTHON VS C 🔥🎯 | Leetcode Problem of the Day
1605. Find Valid Matrix Given Row and Column Sums Python and C++ | 🔥🎯PYTHON VS C++ 🔥🎯 | Leetcode
Переглядів 22Місяць тому
1605. Find Valid Matrix Given Row and Column Sums Python and C | 🔥🎯PYTHON VS C 🔥🎯 | Leetcode
1380. Lucky Numbers in a Matrix Python and C++ | 🔥🎯PYTHON VS C++ 🔥🎯 | Leetcode Problem of the day
Переглядів 20Місяць тому
1380. Lucky Numbers in a Matrix Python and C | 🔥🎯PYTHON VS C 🔥🎯 | Leetcode Problem of the day
1717. Maximum Score From Removing Substrings | C++ Vs Python | 🔥🎯 Leetcode 🎯🔥
Переглядів 10Місяць тому
1717. Maximum Score From Removing Substrings | C Vs Python | 🔥🎯 Leetcode 🎯🔥
1598. Crawler Log Folder | C++ Vs Python | 🔥🎯 Leetcode 🎯🔥
Переглядів 192 місяці тому
1598. Crawler Log Folder | C Vs Python | 🔥🎯 Leetcode 🎯🔥
Aap konse college mai hai
Sorry bro but i cant share it you can contact me on insta link is in description
Nice ! Keep it up 👍🏻✨👏🏻👏🏻
Thank you! 😃
Amazing explanation ! ❤️👍🏻✨
Glad you liked it
Bro if array is 0 , 6 , 7 for 2nd question what should be the output? YES or NO
It would be No Just a simple logic first number is 0 so we cant iterate through it 2nd number is 6 so set b= { 6 : 1 } And count += 1 --> 1 3rd number is 7 so set b = { 6:1 , 7:1 } And count +=1 --> 2 Now finally our count total is 2 which is greater than 1 Count > 1 so answer is No
bro in last question u didn't explain that how u generated that formula
@@StrawDev basically it calculates the ascii value of 1st and last charecter of string we put base value as 2 and sum of 2 zero charecters and then subtracted the 0th char and the last char basically The formula is designed to calculate a result based on the ASCII values of the characters at the ends of the binary string, with adjustments and normalization factors. The min(..., n) ensures the result is within the length of the string, handling specific constraints or requirements of the problem.
Nice
Thanks
Kya aap contest ke que bhi karayege
Yes for sure
Bhaiyaa aap ki rating kya hai codechef mai
3*
Bhaiya kuch tips do na 😋
You can contact me on my instagram handle instagram.com/urs_p_ubuntu?igsh=MTAzMWk0NHhoYzZnMg==
Bhaiya aap toh itne hushaar ho , aap toh Google mai honge na 🤔🤗
No actually I am a student
Very nice !! Explanation keep it up ❤️👏🏻👏🏻👍🏻
Thank you! 😃
Nice explanation
Nice explanation
Nice explanation
dark mode
Bhai, contest ko mazaak kyun banake rakha hai, ye rating talented logo ko apna capabilities dikhane ka ek jariya hai, please chhod de
Bro, I know you are very honest, but why are you coming and looking at contest solutions? These are meant to help beginners, not for people preparing for Google interviews like you.
@@CodeBreakz I too came but not to look at your solutions but to report the channel xD
bro how to visualize python code?
You have to just read the code line by line for each iteration . I have uploaded more precise Explanation in drive: drive.google.com/file/d/1MzNDI2hLlTuPHSJmyFVnIXeo8EPpTne8/view?usp=drivesdk then also if you have any doubt you can comment me
@@CodeBreakz thank you🙏
@@CodeBreakz thank you for sharing drive... I'm freshie learning dsa, already I studied ml... after watching tutorial in dsa I'm unable to solve any problem should I just read others code n dry code it or something else should I do??
Listen try to solve easy level problems in leetcode or any other platforms practice it and then move on the medium level problems which are of the same type For example : 1. Minimum Number of K Consecutive Bit Flips 2. Minimum Operations to Make Binary Array Elements Equal to One I Both are of same type just way to solve and approach varies so try to solve easy level problems then go on same type problem but with more difficulty and try solving problem by yourself first then if you feel you can see other code but try to understand how the loops try to find the answer
@@CodeBreakz I'll surely follow this technique thank you🙏
Hlo bro
Hello !!
bahut kharab explanation
I will try to improve thank you for your response
Bhai tujhse nahi hoga rehne de 😂
Thanks for your feedback! I'll keep working on improving my content.
Amazing explanation!... Thank you:)
Glad you liked it
Java code Scanner scanner = new Scanner(System.in); int T = scanner.nextInt(); scanner.nextLine(); // consume the newline after T int[] results = new int[T]; for (int i = 0; i < T; i++) { String S = scanner.nextLine(); int min_horizontal = 0, max_horizontal = 0, min_vertical = 0, max_vertical = 0; if (S.charAt(0) == '1') { min_horizontal = -10; } if (S.charAt(1) == '1') { max_horizontal = 10; } if (S.charAt(2) == '1') { max_vertical = 10; } if (S.charAt(3) == '1') { min_vertical = -10; } int number_of_cells = (max_horizontal - min_horizontal + 1) * (max_vertical - min_vertical + 1); results[i] = number_of_cells; } for (int result : results) { System.out.println(result); }
Python code import sys input_func = sys.stdin.read data = input_func().split() T = int(data[0]) results = [] for i in range(1, T + 1): S = data[i] min_horizontal, max_horizontal = 0, 0 min_vertical, max_vertical = 0, 0 if S[0] == '1': min_horizontal = -10 if S[1] == '1': max_horizontal = 10 if S[2] == '1': max_vertical = 10 if S[3] == '1': min_vertical = -10 number_of_cells = (max_horizontal - min_horizontal + 1) * (max_vertical - min_vertical + 1) results.append(number_of_cells) for result in results: print(result)
Java code Scanner scanner = new Scanner(System.in); // Number of test cases int numTestCases = scanner.nextInt(); // To store the results for each test case int[] results = new int[numTestCases]; for (int testCase = 0; testCase < numTestCases; testCase++) { // Size of the array int arraySize = scanner.nextInt(); int[] array = new int[arraySize]; // Input array elements for (int i = 0; i < arraySize; i++) { array[i] = scanner.nextInt(); } // Calculate the total sum of the array int totalSum = 0; for (int num : array) { totalSum += num; } if (totalSum % 2 == 0) { // If total sum is even, the largest subarray is the entire array results[testCase] = arraySize; } else { // If total sum is odd, find the first and last odd element indices int leftOddIndex = -1; int rightOddIndex = -1; for (int i = 0; i < arraySize; i++) { if (array[i] % 2 != 0) { leftOddIndex = i; break; } } for (int i = arraySize - 1; i >= 0; i--) { if (array[i] % 2 != 0) { rightOddIndex = i; break; } } // Determine the largest subarray length with even sum by removing one odd element if (leftOddIndex == 0 || rightOddIndex == arraySize - 1) { results[testCase] = arraySize - 1; } else { results[testCase] = Math.max(arraySize - 1 - leftOddIndex, rightOddIndex); } } } // Print all results for (int result : results) { System.out.println(result); } scanner.close();
Python code # Number of test cases num_test_cases = int(input()) # To store the results for each test case results = [] for test_case in range(num_test_cases): array_size = int(input()) array = list(map(int, input().split())) total_sum = sum(array) if total_sum % 2 == 0: # If total sum is even, the largest subarray is the entire array results.append(array_size) else: # If total sum is odd, find the first and last odd element indices left_odd_index = -1 right_odd_index = -1 for i in range(array_size): if array[i] % 2 != 0: left_odd_index = i break for i in range(array_size - 1, -1, -1): if array[i] % 2 != 0: right_odd_index = i break # Determine the largest subarray length with even sum by removing one odd element if left_odd_index == 0 or right_odd_index == array_size - 1: results.append(array_size - 1) else: results.append(max(array_size - 1 - left_odd_index, right_odd_index)) # Print all results for result in results: print(result)
i dont get this logic....please explain bro
I have uploaded a video explanation of this question you can see that by the way sorry bro for late reply
i understood the logic it was difficult to understand in first try😅@@CodeBreakz
import sys input = sys.stdin.read # Read the input data = input().split() T = int(data[0]) results = [0] * T sum_of_first_nine = 45 # 1 + 2 + ... + 9 index = 1 for i in range(T): N = int(data[index]) index += 1 full_cycles = N // 9 remainder = N % 9 # Sum from complete cycles and the remaining part result = full_cycles * sum_of_first_nine + (remainder * (remainder + 1)) // 2 results[i] = result # Output the sum of original values for res in results: print(res)
def count_non_consecutive_pairs(s, n): count_pairs = 0 i = 1 while i < n: if s[i] == s[i - 1]: count_pairs += 1 i += 1 i += 1 return count_pairs def main(): num_test_cases = int(input()) for _ in range(num_test_cases): length = int(input()) moves = input() result = count_non_consecutive_pairs(moves , length) print(length- result) if __name__ == "__main__": main()
import java.util.*; import java.lang.*; import java.io.*; class Codechef { public static void main (String[] args) throws java.lang.Exception { // your code goes here Scanner scanner = new Scanner(System.in); int cases = scanner.nextInt(); for (int k = 0; k < cases; k++) { int amount = scanner.nextInt(); int year = scanner.nextInt(); int result = 0; for (int i = 0; i < year; i++) { if (amount * 2 > amount + 1000) { amount *= 2; result = amount; } else { amount += 1000; result = amount; } } System.out.println(result); } scanner.close(); } }
# cook your dish here for k in range(int(input())): amount,year=map(int,input().split()) result=0 for i in range(year): if(amount*2>amount+1000): amount*=2 result=amount else: amount+=1000 result=amount print(result)
t=int(input()) for i in range(t): n=int(input()) # n is number of integers in n array a=list(map(int,input().split())) subarray = [1]*n # initialises a list subarray of length n with all elements set to 1 # last element always though it may be positive or negative for i in range(n-2,-1,-1): if (a[i]*a[i+1]<0): # 2 -2 -3 # -3*-2==6>0 #last second element is 1 # -2*2=-4<0 # last third element is 1+1=2 # subarray= 2 1 1 subarray[i]=subarray[i+1]+1 else: subarray[i]=1 print(*subarray) # subarray 2 1 1 without* it will print 211 which will give error
whatsapp.com/channel/0029VaUDt2Q23n3kqYyoP43U
class Solution: def isPalindrome(self, x: int) -> bool: if x < 0: return False reversed_num = 0 temp = x while temp != 0: digit = temp % 10 reversed_num = reversed_num * 10 + digit temp //= 10 return reversed_num == x
whatsapp.com/channel/0029VaUDt2Q23n3kqYyoP43U
class Solution { public int[] twoSum(int[] nums, int target) { Map<Integer,Integer> map= new HashMap<>(); // Map and HashMap these are in built codes for writing HashMap for(int i=0;i<nums.length;i++){ // nums={2,7,11,15} and our target element is target=9 // nums.length=4 int substract= target-nums[i]; // substract=9-nums[0 // substract =9-2=7 if(map.containsKey(substract)){ return new int[]{ map.get(substract),i}; } map.put(nums[i],i); } throw new IllegalArgumentException(" No 2 sums have solution"); } }
whatsapp.com/channel/0029VaUDt2Q23n3kqYyoP43U
# Code by Prathamesh Ghodmare class Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: for i in range(len(nums)): # nums=[2,7,11,15] # len(nums)=4 for j in range(i+1,len(nums)): #i+1=0+1=1 #len(nums)=4 #j will start from 1 to 4 if nums[j]==target-nums[i]: #nums[j]=7. and target=9. also nums[i]=2 # 7==9-2 return [i,j]
whatsapp.com/channel/0029VaUDt2Q23n3kqYyoP43U
whatsapp.com/channel/0029VaUDt2Q23n3kqYyoP43U
whatsapp.com/channel/0029VaUDt2Q23n3kqYyoP43U
import java.util.*; import java.lang.*; import java.io.*; class Codechef { public static void main(String[] args) throws java.lang.Exception { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t > 0) { int n = sc.nextInt(); int arr[] = new int[n + 1]; for (int i = 1; i <= n; i++) { arr[i] = sc.nextInt(); } long ans = 0; for (int i = 1; i <= n; i++) { long left = (long) arr[i]; if (left == 1) { ans += (long) n; } else { long power = 1; for (int j = 1; j <= n; j++) { power *= left; if (power > 1000000000L) { break; } else { long right = (long) arr[j]; if (power <= right) { ans++; } } } } } System.out.println(ans); t--; } } }
import java.util.*; class Codechef { public static void main(String[] args) throws java.lang.Exception { Scanner jk = new Scanner(System.in); int t = jk.nextInt(); while (t > 0) { int vk = jk.nextInt(); PriorityQueue<Integer> max = new PriorityQueue<>(Collections.reverseOrder()); PriorityQueue<Integer> min = new PriorityQueue<>(); for (int j = 0; j < vk; j++) { int va = jk.nextInt(); max.add(va); min.add(va); } int ans = 0; int to = vk / 2; while (to > 0) { int ge = max.poll(); int small = min.poll(); int df = ge - small; ans += df; to--; } if (vk % 2 != 0) { ans += min.poll(); } System.out.println(ans); t--; } } }