✅ Day 65 of #100DaysOfLeetCode 📌 Problem: Number of Laser Beams in a Bank 🟡 Difficulty: Medium 📍 Topic: Array / String 🎯 Goal: Calculate the total number of laser beams in a bank by counting security device connections between different rows, where beams only form between devices on different rows 🧠 Key Idea: Approach 1: Iterate through each row of the binary matrix, count devices ('1's) in each row, and multiply consecutive non-zero device counts to calculate beams. Track the previous row's device count, and when encountering a new row with devices, multiply it with the previous count to get beams between those rows. Update the previous count only when the current row has devices, then continue to the next row. Trending Hashtags: #100DaysOfLeetCode #LeetCode #CodingChallenge #DSA #DataStructures #Programming #SoftwareEngineering #CodeDaily #TechCommunity #DeveloperLife #ProblemSolving #AlgorithmChallenge #CodingLife #TechSkills #SoftwareDeveloper
"Day 65 of #100DaysOfLeetCode: Counting Laser Beams in a Bank"
More Relevant Posts
-
🔹 Day 39 of #100DaysOfCode Topic: Pointer Arithmetic and Array Manipulation in C Today I practiced accessing and modifying array elements using pointers. Here's a breakdown of what the code does: 🧠 Code Summary: Array Declaration: An integer array arr[] is initialized with values {10, 20, 30, 40, 50}. Pointer Initialization: A pointer ptr is assigned to point to the first element of the array (arr). Accessing Elements via Pointer Arithmetic: Using *(ptr + i), each element is accessed by moving the pointer i steps forward. This demonstrates how pointers can traverse arrays without using traditional indexing. Modifying Elements via Pointer Arithmetic: Each element is incremented by 5 using *(ptr + i) += 5. This shows how pointers can directly modify array values. 🖥️ Output: The program first prints the original array values, then prints the updated values after adding 5 to each. #CProgramming #PointersInC #ArrayManipulation #CodeNewbie #LearnToCode
To view or add a comment, sign in
-
🚀 LeetCode Daily Challenge – Day 4 (November 2025) 🧩 Problem: 3318. Find X-Sum of All K-Long Subarrays I 📚 Topic: Arrays | Sliding Window | HashMap | Prefix Sum 🔍 Approach: Used a sliding window of size k to compute the X-sum for each subarray. Maintained frequency counts of elements within the window and dynamically updated the sum as elements entered and left the window. This approach efficiently avoids recalculating sums from scratch for every subarray. ✅ Time Complexity: O(n) ✅ Space Complexity: O(k) 💡 Key Takeaway: Sliding window problems reinforce how optimizing repetitive computations can drastically improve performance — small logic, big impact! ⚡ #LeetCode #LeetcodeDailyChallenge #Coding #DSA #SlidingWindow #Array #HashMap #Day4 #Programming #Engineering
To view or add a comment, sign in
-
-
I solved Matrix Multiplication using 2D Arrays in C! 💻 It was a big and challenging code, but I enjoyed solving it and improving my understanding of arrays and loops. Step by step, I’m getting better at problem-solving and logic building. 🚀enter the 1th matrix row and column: 3 enter the 1th matrix column: 3 enter the elements 1th matrix: 1 2 3 4 5 6 7 8 9 enter the 2th matrix row: 3 enter the 2th matrix column: 3 enter the elements 2th matrix: 9 8 7 6 5 4 8 9 7 the result of matrices: 45 45 36 114 111 90 183 177 144 #CProgramming #Arrays #CodingJourney #LearningEveryday
To view or add a comment, sign in
-
📅 Day 63 of #100DaysOfCode Today’s challenge was all about matrix manipulation in C! I built a simple yet powerful program that: ✅ Accepts a 3×3 matrix from user input ✅ Displays the original matrix in formatted output ✅ Computes and prints its transpose by swapping rows and columns This exercise reinforced my understanding of 2D arrays, nested loops, and matrix operations—core concepts in both math and programming. It’s a great stepping stone toward more advanced topics like matrix multiplication and determinants. Let’s keep the momentum going! 🚀 #CProgramming #MatrixTranspose #CodeNewbie #LearnToCode #DailyCoding #CodingChallenge #TechJourney #100DaysChallenge #CodeWithAnmol #VisualCoding #2DArrays #TransposeMatrix #Day63
To view or add a comment, sign in
-
On Day 294 of my #300daysofcode challenge, I'm sharing my solution to LeetCode Problem 1146, "Snapshot Array." This problem requires designing a specialized array that efficiently handles updates and historical queries. My video provides a clear walkthrough of the optimal design: using a list of versioned entries per index and then applying Binary Search to query the correct historical state. This is a valuable skill for system design and advanced data structure implementation. #DataStructures #Algorithms #LeetCode #CodingInterview #Programming #SystemDesign #300daysofcode
To view or add a comment, sign in
-
In this program, I used a while loop to print numbers in reverse order (from 10 down to 1). ⏬ Instead of increasing the value, this time I used the decrement operator (n--) to reduce the number step by step — a simple but powerful way to understand how loops can work in both directions! 🔁 ✨ Concepts Covered: ➡️ Variable initialization (n = 10;) ➡️ Loop condition (n >= 1) ➡️ Decrement operator (n--) ➡️ Output with printf() Practicing reverse loops helps in understanding control flow — useful in countdown timers, reversing arrays, and more! 🚀 #CProgramming #WhileLoop #CodingBasics #ProgrammingJourney #LearnToCode #Countdown #CodePractice 💻
To view or add a comment, sign in
-
-
🚀 Day 61 of #GFG160 Challenge 🚀 🔹 Problem: Equilibrium Point 🔹 Topic: Prefix Sum, Arrays 💡 Problem Statement: Find the index in an array such that the sum of elements on the left equals the sum of elements on the right. If no such index exists, return -1. ⚙️ Approach: Instead of recalculating sums again and again, we can use a prefix-sum optimization: 1️⃣ Compute the total sum of the array. 2️⃣ Traverse the array while keeping track of the left sum. 3️⃣ At each index i, the right sum can be found as totalSum - leftSum - arr[i]. 4️⃣ If leftSum == rightSum, that index is the equilibrium point. ⏱️ Time Complexity: O(n) 💾 Space Complexity: O(1) 🔸 This problem reinforces the importance of prefix sums and how they can turn an O(n²) brute-force into an efficient O(n) solution. #GFG160 #ProblemSolving #DSA #CodingChallenge #CPlusPlus #GeeksforGeeks #Programming
To view or add a comment, sign in
-
-
🌀 Day 48 of #100DaysOfCode Today I tackled a visually satisfying challenge—generating a Spiral Matrix in C! The program dynamically fills an n x n matrix in a clockwise spiral pattern using boundary pointers (top, bottom, left, right) and a value counter. It’s a great exercise in mastering loop control and matrix traversal. ✨ Highlights: Clean logic using layered loops Dynamic matrix filling without recursion Output beautifully formatted for clarity 🔢 Input: Matrix size n (1–20) 📤 Output: Spiral matrix printed with aligned values 📌 Perfect for practicing: Array manipulation Loop boundaries Visual formatting in C #CProgramming #Day48 #CodingChallenge #LearnByDoing #VisualAlgorithms #CodeCraft
To view or add a comment, sign in
-
Must-Know Algorithms for Every Programmer! Whether you’re into Data Structures, Graphs, or Optimization — mastering algorithms is the secret to writing efficient code Key Topics: Stack, Queue, BST, Hashing DFS & BFS Dijkstra & Bellman-Ford Dynamic & Greedy Algorithms Pattern Matching Techniques Level up your problem-solving skills today! 👉 https://lnkd.in/gxYyJQAU #Programming #Algorithms #DataStructures #CodingSkills #SoftwareDevelopment #LearnToCode #DigitalEarnSolution #TechLearning
To view or add a comment, sign in
-
More from this author
Explore related topics
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development