There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). You may assume nums1 and nums2 cannot be both empty. Example 1: nums1 = [1, 3] nums2 = [2] The median is 2.0 Example 2: nums1 = [1, 2] nums2 = [3,…… Continue reading Leetcode 4 Median of Two Sorted Arrays Java Solution
Category: Java
HashMap In Java With Example
Here we will learn about the Java HashMap class with an example along with the functions provided by the Java HashMap class which resides in the Java util package. The Java HashMap class implements the Map interface, which is used for storing key-value pairs. HashMap is represented as HashMap<Key, Value> or HashMap<K, V>, the key…… Continue reading HashMap In Java With Example
Resilience4j Circuit Breaker With Spring boot
What is a Circuit Breaker pattern? The circuit breaker pattern is something that can prevent from repeatedly trying to call a service or a function that will likely fail and save CPU cycles. It is pretty common for a software service to call remote software service and the remote service can fail or not respond…… Continue reading Resilience4j Circuit Breaker With Spring boot
Arrays In Java With Example
The array is a data structure provided by Java which holds elements of the same data type with a fixed size.An array can hold elements/ values of the same data type, an example being we can create an array that can store 100 elements of type either int/String/char etc.. We can not have array hold…… Continue reading Arrays In Java With Example
Java ArrayList With Example
ArrayList is a resizable implementation of List interface, ArrayList can also be called as a dynamic Array. Like Array, ArrayList stores similar data type elements which can increase its size dynamically.ArrayList cannot store primitive data types like int and char, it can only store non-primitive data types like Integer, String, etc..The index of the ArrayList…… Continue reading Java ArrayList With Example
Netflix Eureka Server And Client Setup With Spring Boot
Overview We will set up a Eureka server (service registry used to register multiple services/microservices).We will set up multiple Eureka clients(REST services that register to Eureka Server).We will do client-side load balancing and service discovery through Eureka. Setting up Eureka Server The dependency required to set up a eureka server is “spring-cloud-starter-netflix-eureka-client” along with spring-boot-starter-parent.…… Continue reading Netflix Eureka Server And Client Setup With Spring Boot
Java Datatypes
What is a Datatype?A data type is an attribute of data that tells the compiler or interpreter how the programmer intends to use the data. Data types in Java programming language There are two different sets of data types in Java Primitive DatatypesNon Primitive Datatypes The below image depicts different data types in java Java…… Continue reading Java Datatypes
Difference between JDK, JRE, and JVM
In this post, we will see the major differences between JDK, JRE, and JVM. JDK (Java Development Kit): JDK is the one you need to build applications in Java, it contains everything that is required to build and run Java applications. When you download java from the oracle site to develop applications you actually download…… Continue reading Difference between JDK, JRE, and JVM