Thursday, December 1, 2022

Easy_Question27 : 3Sum - Given an integer array nums, return all the triplets

Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0.

Notice that the solution set must not contain duplicate triplets.

Wednesday, November 30, 2022

System_Design : CAP vs. PACELC

  • In distributed systems, different types of failures can occur, e.g., servers can crash or fail permanently, disks can go bad resulting in data losses, or network connection can be lost, making a part of the system inaccessible. 
  • How can a distributed system model itself to get the maximum benefits out of different resources available? 

  • What are the guiding principles to help distributed systems choose a desirable balance between various distributed characteristics?

  • Check Grokking the System Design Interview to learn about important distributed system concepts.

Easy_Question26 : find the length of the longest substring without repeating characters.

Given a string s, find the length of the longest substring without repeating characters.

Example 1:

Input: s = "abcabcbb"

Output: 3

Explanation: The answer is "abc", with the length of 3.

Tuesday, November 15, 2022

Java memory arguments for Containers

  • When you are running your Java application in physical servers, you would have been using ‘-Xmx’ JVM argument to specify the Java heap size. 
  • If you are porting your application to Containers, you might be wondering how to configure Java heap size in the container’s world?

Wednesday, November 9, 2022

StackoverflowError: Causes & Solutions

StackOverFlowError is one of the commonly confronted JVM errors. In this blog post, let's learn the inner mechanics of thread stacks, reasons that can trigger StackOverFlowError and potential solutions to address this error.

Tuesday, November 8, 2022

Benefits of setting initial and maximum memory size to the same value


  • When we launch applications, we specify the initial memory size and maximum memory size. For the applications that run on JVM (Java Virtual Machine), initial and maximum memory size is specified through ‘-Xms’ and ‘-Xmx’ arguments. 
  • If Java applications are running on containers, it’s specified through ‘-XX: InitialRAMPercentage’ and ‘-XX: MaxRAMPercentage’ arguments. Most enterprises set the initial memory size to a lower value than the maximum memory size. 
  • As opposed to this commonly accepted practice, setting the initial memory size the same as the maximum memory size has certain ‘cool’ advantages.

Tuesday, November 1, 2022

Question 20 : Flattening Nested Collections using java 8

Example of a Nested Collection

List<List<String>> nestedList = asList(
  asList("two:one", "two:two", "two:three"), 
  asList("three:one", "three:two", "three:three", "three:four"));
Follow on LinkedIn

You may also like

Kubernetes AWS Java Coding Question
Microservices Core Java Spring Boot
Spring Framework Kafka Miscellaneous