Sign of the Product of an Array There is a function signFunc(x) that returns: 1 if x is positive. -1 if x is negative. 0 if x is equal to 0. You are given an integer array nums. Let product be the product of all values in the array nums. Return signFunc(product). The problem description…
Category: Miscellaneous
leetcode 1816 solution in java
Truncate Sentence A sentence is a list of words that are separated by a single space with no leading or trailing spaces. Each of the words consists of only uppercase and lowercase English letters (no punctuation). For example, “Hello World”, “HELLO”, and “hello world hello world” are all sentences. You are given a sentence s…
What is the use of getters and setters in java?
Getters and Setters are mainly used to hide the details about the fields of a class. Suppose we have a class, named Car. As we know, class in a blueprint of an object. So, the Car class is the blueprint of real object Car. Now Car object has engines and wheels. We are using only…
How to Download and Install JMeter on windows 10?
Download And Installation Of JMeter is mentioned below:- Step 1:- Go to the below mentioned link. Which is the official site for Apache JMeter. JMeter Download Step 2:- Download the zip file from Binaries Section. Zip file is applicable for Windows Operating System. As here clearly mentioned that Java 8+ is required and it should…
What is Response Time in the context of Performance Testing?
In a simple term, response time is the time taken by any application or software to respond any request of the user. There are various types of terms are used which are related to response time:- Absolute Response Time:- As shown in the above picture, it is the exact same as (time of response noticed…
What is performance testing and what is it’s importance?
Performance testing is the segment of software testing where the software applications are tested on a particular work load. This work load are calculated based on the user experience and is usually shared by the Business Team. And the behavior of that application like stability and response time under that predefined workload is measured and…
leetcode 1854 solution in java
Maximum Population Year Solution This above problem is taken from https://leetcode.com/problems/maximum-population-year/ Solution:- Approach:- Code:- public static int methodeName(int[][] arr) { //defined one array years with size 2051 int[] years = new int[2051]; //Now hover over the goven 2d array for (int[] log : arr) { //given array is {1952,1961},{1953,1961 } //so for first iteration log…
leetcode 1859 solution in java
Sorting the Sentence A sentence is a list of words that are separated by a single space with no leading or trailing spaces. Each word consists of lowercase and uppercase English letters. A sentence can be shuffled by appending the 1-indexed word position to each word then rearranging the words in the sentence. For example,…
LeetCode 1869 Solution in Java
Longer Contiguous Segments of Ones than Zeros Solution:- Approach:- Code:- public boolean checkZeroOnes(String s) { int countOne = 0; int countZero = 0; int maxOne=0; int maxZero = 0; for ( char m:s.toCharArray()) { if (m==’0′) { countZero ++; countOne=0; } if (m==’1′) { countOne ++; countZero=0; } maxOne = Math.max(maxOne,countOne); maxZero = Math.max(maxZero,countZero); }…
Leet code 35 Java Solution: Search insert position
Problem:- Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. Solution:- Summary of the problem:- Here we have to search in the given sorted array that if the given number…