## 6074. Percentage of Letter in String

Given a string s and a character letter, return the percentage of characters in s that equal letter rounded down to the nearest whole percent. Example 1: Input: s = “foobar”, letter = “o” Output: 33 Explanation: The percentage of characters in s that equal the letter ‘o’ is 2 …

## Squares of a Sorted Array Leetcode Solution

Given an integer array nums sorted in non-decreasing order, return an array of the squares of each number sorted in non-decreasing order. Example 1: Input: nums = [-4,-1,0,3,10] Output: [0,1,9,16,100] Explanation: After squaring, the array becomes [16,1,0,9,100]. After sorting, it becomes [0,1,9,16,100]. Example 2: Input: nums …

## Find Numbers With Even Number of Digits Solution

Given an array nums of integers, return how many of them contain an even number of digits. Example 1: Input: nums = [12,345,2,6,7896] Output: 2 Explanation: 12 contains 2 digits (even number of digits).  345 contains 3 digits (odd number of digits).  2 …

## Max Consecutive Ones Leetcode Solution

Given a binary array nums, return the maximum number of consecutive 1‘s in the array. Example 1: Input: nums = [1,1,0,1,1,1] Output: 3 Explanation: The first two digits or the last three digits are consecutive 1s. The maximum number of consecutive 1s …

## lambda expressions can be used to represent the instance of a functional interface( lambda expressions are supported java 8 onwards).

Functional Interfaces: Key points: Functional interface contains only one abstract method.  Functional interface can have only one functionality to exhibit.  Functional interface can have any number of default methods.  Note: lambda expressions can be used to represent the instance of …

## L36 Understanding Interface, Using Interfaces

// L36 Understanding Interface, Using Interfaces B,D package q11284; interface Car { String getName(); int getMaxSpeed(); default void applyBreak() { } static void getFastestCar(Car car1, Car car2) { } } class BMW implements Car { String name; int maxSpeed; …

## L34 Method overloading and Method overriding, Super keyword, Polymorphism, Object Class

// L34 Method overloading and Method overriding, Super keyword, Polymorphism, Object Class A,B,C package q11266; public class Addition {public static void main(String[] args) {int a = Integer.parseInt(args[0]);int b = Integer.parseInt(args[1]);float d = Float.parseFloat(args[2]);float e = Float.parseFloat(args[3]);double h = Double.parseDouble(args[4]);double …

## Data Structures – hashCode(), Map, HashMap, TreeMap, LinkedHashMap

Data Structures – hashCode(), Map, HashMap, TreeMap, LinkedHashMap