Leetcode

1695. Maximum Erasure Value

Understanding the Problem Given an array of integers nums, our task is to find the maximum sum of a contiguous subarray containing only unique elements. Approach We can solve this problem using a sliding window approach. We’ll maintain two pointers, start and end, to define the current subarray. Additionally, we’ll use a HashSet to keep…

Leetcode

49. Group Anagrams

Understanding the Problem Given an array of strings strs, our task is to group the strings that are anagrams of each other together and return them as a list of lists. Approach To efficiently group anagrams, we can leverage the properties of anagrams. Two strings are anagrams of each other if they have the same…

Leetcode

387. First Unique Character in a String

The First Unique Character in a String problem is a common algorithmic challenge where the goal is to find the index of the first non-repeating character in a given string. In this blog, we will explore the problem, understand the solution, and discuss the implementation details. Problem Statement Given a string s, we are required…

Leetcode

76. Minimum Window Substring

The Minimum Window Substring problem is a classic problem in string manipulation and is frequently encountered in coding interviews and real-world applications. In this blog, we’ll explore the problem, understand its solution, and discuss the implementation details. Problem Statement Given two strings s and t, we are tasked with finding the minimum window substring of…

Leetcode

1291. Sequential Digits

Sequential digits are numerical sequences where each digit in a number is incremented by one compared to its predecessor. For example, 123, 234, and 345 are sequential digits because each subsequent number follows a pattern of increasing by one. These sequences are not only intriguing but also have practical applications in mathematics, computer science, and…

Tech

Configuring CORS (Cross-Origin Resource Sharing) in Micronaut

Introduction: Cross-Origin Resource Sharing (CORS) is an important security feature implemented by web browsers to prevent malicious websites from accessing resources on other domains. In a Micronaut application, configuring CORS properly ensures that your APIs can be accessed securely from web applications hosted on different origins. In this blog post, we’ll explore how to configure…

Micronaut

How To Serve PDF Files from a Micronaut Controller

In web applications, serving static files like PDFs is a common requirement, especially when dealing with documents, reports, or downloadable content. Micronaut, a modern JVM-based framework for building microservices and serverless applications, provides convenient features for handling file downloads from controllers. In this blog, we’ll explore how to serve PDF files from a Micronaut controller…

Leetcode

739. Daily Temperatures

In the realm of algorithmic problem-solving, certain patterns and techniques emerge as powerful tools for tackling a variety of challenges. One such technique involves the clever use of stacks to efficiently solve problems that require finding the next greater element or value in an array. In this blog, we’ll explore how to leverage the stack…