🔹 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
More Relevant Posts
-
✅ 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
To view or add a comment, sign in
-
-
1526. Minimum Number of Increments on Subarrays to Form a Target Array 1526. Minimum Number of Increments on Subarrays to Form a Target Array Difficulty: Hard Topics: Array, Dynamic Programming, Stack, Greedy, Monotonic Stack, Biweekly Contest 31 You are given an integer array target. You have an integer array initial of the same size as target with all elements initially zeros. In one operation you can choose any subarray from initial and increment each value by one. Return the minimum number of operations to form a target array from initial. The test cases are generated so that the answer fits in a 32-bit integer. Example 1: Input: target = [1,2,3,2,1] Output: 3 Explanation: We need at least 3 operations to form the target array from the initial array. [0,0,0,0,0] increment 1 from index 0 to 4 (inclusive). [1,1,1,1,1] increment 1 from index 1 to 3 (inclusive). [1,2,2,2,1] increment 1 at index 2. [1,2,3,2,1] target array is formed. Example 2: Input: target = [3,1,1,2] Output: 4 Explanation: [0,0,0,0] -> [1,1,1,1] -> [1,1,1,2] -> [2,1,1,2] -> [3,1,1,2] https://lnkd.in/geCSn5Fq
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
-
-
🔥 Dynamic Programming in Action: Partition Equal Subset Sum Problem: Determine if an array can be split into two subsets with equal sum. Approach: 1. Calculate the total sum. If it's odd, partitioning is impossible. 2. Use 1D DP array: dp[i] indicates whether a subset sum of i is achievable. 3. Iterate through the array and update dp backwards to avoid overwriting previous results. 4. If dp[sum/2] is true, the array can be partitioned into two equal subsets. Key Techniques: Dynamic Programming, Subset Sum Problem, Space Optimization #Algorithms #DynamicProgramming #ProblemSolving #Coding #Cplusplus #Tech #Programming
To view or add a comment, sign in
-
-
🧩 Day 64 of #100DaysOfCode 🧩 🔹 Problem: Remove All Adjacent Duplicates in String – LeetCode ✨ Approach: Used a stack-based approach to efficiently remove adjacent duplicates. For each character, if it matches the stack’s top element, pop it — otherwise, push it. A simple yet powerful way to process strings in O(n) time while maintaining clean logic. ⚡ 📊 Complexity Analysis: Time Complexity: O(n) — each character is processed once Space Complexity: O(n) — for the stack and output string ✅ Runtime: 23 ms (Beats 54.52%) ✅ Memory: 45.26 MB (Beats 85.43%) 🔑 Key Insight: Sometimes, solving problems isn’t about brute force — it’s about using the right data structure to make every step count. 💡 #LeetCode #100DaysOfCode #ProblemSolving #DSA #Stack #StringManipulation #CleanCode #CodingChallenge #AlgorithmDesign #LogicBuilding #CodeJourney #Programming
To view or add a comment, sign in
-
-
🚀 DSA Progress – Day 99 ✅ Problem #190: Reverse Bits 🧠 Difficulty: Easy | Topics: Bit Manipulation, Binary Representation, Bitwise Operations 🔍 Approach: Implemented a bitwise manipulation method to reverse all 32 bits of an unsigned integer. This problem helps build a strong understanding of how bits can be extracted, shifted, and reassembled — a key concept in low-level programming and embedded systems. Step 1 (Initialization): Start with rev = 0 to store the reversed bits. Step 2 (Extract + Reverse): For each bit position i from 0 to 31: Extract the ith bit using (n >> i) & 1. Move that bit to its reversed position (31 - i) using (bit << (31 - i)). Combine it into rev using bitwise OR (|=). Step 3 (Return Result): After processing all bits, return the reversed number as the final result. 🕒 Time Complexity: O(32) → effectively O(1) (constant time) 💾 Space Complexity: O(1) → no extra data structures used 📁 File: https://lnkd.in/gKeNZQf9 📚 Repo: https://lnkd.in/g8Cn-EwH 💡 Learned: This problem deepened my understanding of bit-level operations like shifting (<<, >>) and masking (&, |). It showed how reversing bits is similar to flipping binary mirrors — a useful concept in embedded systems, graphics, and cryptographic algorithms. The challenge reinforced that mastering bitwise logic is essential for writing efficient, low-level optimized code. ✅ Day 99 complete — flipped every bit, reversed the logic, and came out enlightened! ⚡💡💻 #LeetCode #DSA #Python #BitManipulation #Binary #CodingChallenge #InterviewPrep #100DaysOfCode #DailyCoding #GitHubJourney
To view or add a comment, sign in
-
Ever tried to play a video on a microcontroller? You hit a RAM wall almost immediately. 🧱 I'm excited to share a project that tackles this problem head-on! 🚀 I built a full Python build system that automates the entire conversion process, with a heavy focus on low-level implementation. 🐍 Here's the pipeline: ⚙️ 1. Parse GIF: A script reads the animated GIF 🎞️, correctly interprets frame disposal methods (e.g., "restore to background"), and composites each frame to create a clean, full-frame sequence. 2. Convert & Pack: A second script takes these frames, resizes them to 128x64, converts them to 1-bit monochrome 🔳, and manually packs 8 pixels into a single byte. 3. Build .ino: The final script reads all these byte arrays and automatically generates a complete Arduino sketch. 📄 This was a perfect blend of high-level scripting (Python, regex) and low-level hardware constraints (C++, memory management, bit-packing). 💻 You can find all the Python build scripts and the full README on my GitHub: https://lnkd.in/gUHgbKN4 🔗 #ESP8266 #Arduino #Python #EmbeddedSystems #CPlusPlus #MemoryOptimization #OLED #SSD1306 #PROGMEM #Automation #Makers #Electronics
To view or add a comment, sign in
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