Count Sub Islands LeetCode Solution

Count Sub Islands

Count Sub Islands You are given two m x n binary matrices grid1 and grid2 containing only 0‘s (representing water) and 1‘s (representing land). An island is a group of 1‘s connected 4-directionally (horizontal or vertical). Any cells outside of the grid are considered water cells. An island in grid2 is considered a sub-island if there is an island in grid1 that contains all the cells that make up this island in grid2. Return the number of islands in grid2 that are considered sub-islands. … Read more

The Number of Full Rounds You Have Played Leetcode Solution

The Number of Full Rounds You Have Played

The Number of Full Rounds You Have Played A new online video game has been released, and in this video game, there are 15-minute rounds scheduled every quarter-hour period. This means that at HH:00, HH:15, HH:30 and HH:45, a new round starts, where HH represents an integer number from 00 to 23. A 24-hour clock is used, so the earliest time in the day is 00:00 and the latest is 23:59. Given two strings startTime and finishTime in … Read more

Largest Odd Number in String Leetcode Solution

Largest Odd Number in String Solution

Largest Odd Number in String You are given a string num, representing a large integer. Return the largest-valued odd integer (as a string) that is a non-empty substring of num, or an empty string “” if no odd integer exists. A substring is a contiguous sequence of characters within a string. Example 1: Input: num = “52” Output: “5” Explanation: The only non-empty substrings are “5”, … Read more

F. Prefixes and Suffixes Codeforces Solution Kotlin Heroes: Practice 7

F. Prefixes and Suffixes Codeforces Solution Ivan wants to play a game with you. He picked some string s of length n consisting only of lowercase Latin letters. You don’t know this string. Ivan has informed you about all its improper prefixes and suffixes (i.e. prefixes and suffixes of lengths from 1 to n−1), but … Read more

E. Good Array Codeforces Solution Kotlin Heroes: Practice 7

E. Good Array Codeforces Solution Let’s call an array good if there is an element in the array that equals to the sum of all other elements. For example, the array a=[1,3,3,7] is good because there is the element a4=7 which equals to the sum 1+3+3. You are given an array a consisting of n … Read more

D. Teams Forming Codeforces Solution Kotlin Heroes: Practice 7

D. Teams Forming Codeforces Solution There are n students in a university. The number of students is even. The i-th student has programming skill equal to ai. The coach wants to form n2 teams. Each team should consist of exactly two students, and each student should belong to exactly one team. Two students can form … Read more

C. Uniform String Codeforces Solution Kotlin Heroes: Practice 7

C. Uniform String Codeforces Solution You are given two integers n and k. Your task is to construct such a string s of length n that for each i from 1 to k there is at least one i-th letter of the Latin alphabet in this string (the first letter is ‘a’, the second is … Read more

B. Frog Jumping Codeforces Solution Kotlin Heroes: Practice 7

B. Frog Jumping Codeforces Solution A frog is currently at the point 0 on a coordinate axis Ox. It jumps by the following algorithm: the first jump is a units to the right, the second jump is b units to the left, the third jump is a units to the right, the fourth jump is … Read more

A. A+B (Trial Problem) Codeforces Solution Kotlin Heroes: Practice 7

A. A+B (Trial Problem) Codeforces Solution You are given two integers a and b. Print a+b. InputThe first line contains an integer t (1≤t≤104) — the number of test cases in the input. Then t test cases follow. Each test case is given as a line of two integers a and b (−1000≤a,b≤1000). OutputPrint t … Read more

AMCAT Technical Questions

AMCAT Technical Q1. A new language has 15 possible letters, 8 different kinds of punctuation marks – and a blank character. Rahul wants to create two data types, first one which could store the letters of the language and a second one which could store any character in the language. The number of bits required … Read more

close
error: Content is protected !!
Free Udemy Courses and Hacking Resources Join Us on TelegramClick Here
+