1 Reverse String Write a function that reverses a string. The input string is given as an array of characters s. You must do this by modifying the input array in-place with O(1) extra memory. Example 1: Input: s = [“h”,”e”,”l”,”l”,”o”] Output: [“o”,”l”,”l”,”e”,”h”] Example 2: Input: s = [“H”,”a”,”n”,”n”,”a”,”h”] Output: [“h”,”a”,”n”,”n”,”a”,”H”] Constraints: Solution: 2 Longest Common Prefix Write a function … Read More “String related LC questions | Javascript” »
Category: Java
JavaScript is a popular programming language used for creating dynamic and interactive web applications. One of its key features is its single-threaded model. In this blog post, we will explore what this means, how it works, and its advantages and disadvantages. What is the Single-Threaded Model in JavaScript? A thread is a sequence of instructions … Read More “Understanding JavaScript’s Single-Threaded Model: Benefits and Limitations” »
Java is a widely-used programming language that has been around since the mid-1990s. Over the years, it has undergone several updates and revisions, with the latest version being Java 17. Learning Java can be a daunting task, especially for beginners who are just starting out. However, with the right resources, it is possible to learn … Read More “Java | Recommended books and resources for learning Java” »
When developing Java applications, build tools are essential for managing dependencies, building the project, and automating the build process. Two popular build tools in the Java ecosystem are Maven and Gradle. In this article, we’ll provide an overview of these build tools and show how to use them in a Java project. Maven Maven is … Read More “Java | Overview of build tools (Maven, Gradle)” »
Testing is an essential part of software development as it helps to ensure the quality of the application by detecting and resolving issues before the product reaches the end user. In Java programming, there are several testing frameworks available that help to automate the testing process and make it more efficient. Two of the most … Read More “Java | Overview of testing frameworks (JUnit, TestNG)” »
Java is one of the most popular programming languages and has a vast array of frameworks and tools available for developers. Three of the most widely used Java frameworks are Spring, Hibernate, and Struts. In this article, we’ll provide an overview of each framework and how they can be used in Java development. Spring Framework … Read More “Java | Overview of popular Java frameworks (Spring, Hibernate, Struts)” »
Java 12 introduced a new feature called Switch Expressions, which allows developers to use switch as an expression that returns a value, rather than just a statement. In this article, we’ll explore this new feature and see how it can be useful in Java programming. Switch expressions in Java can be written in two forms, … Read More “Java | Switch expressions” »
Java’s HTTP client API was introduced in Java 11 as a replacement for the legacy HttpURLConnection API. The new API provides a more modern, easy-to-use interface for sending HTTP requests and handling responses. Creating an HTTP Client To use the HTTP client API, you first need to create an instance of the HttpClient class. Here’s … Read More “Java | HTTP client API” »
ava 10 introduced a new method called Collectors.toUnmodifiableList() that returns an unmodifiable List which is a view over the original List. In this article, we will explore the toUnmodifiableList() method and how it can be used in Java programming. Introduction to Collectors.toUnmodifiableList() Method The Collectors.toUnmodifiableList() method returns an unmodifiable List that is a view over … Read More “Java | Collectors.toUnmodifiableList() method” »
Local variable type inference is a feature introduced in Java 10 that allows developers to use the ‘var’ keyword to declare variables without explicitly specifying their type. This feature is useful for simplifying code and reducing the amount of boilerplate code that needs to be written. In this article, we’ll explore the var keyword in … Read More “Java | Local variable type inference (var keyword)” »