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 …

Railway Recruitment Cell (RRC NCR)

NCR RRC Prayagraj Junior Technical Assistant JTA Recruitment 2022 Advt No. : NCR/HQ/CONSTRUCTION/01/2022 Short Details of Notification;- Candidates having any kind of query so he/she can ask in our comment section. Our Panel will b reverting back as soon …

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; …