Posts

Showing posts from September 9, 2021

Laptops & WI-FI Hotspots

Image
Laptops & WI-FI Hotspots PROBLEM STATEMENT : The program must accept a string S as the input. The string S contains only the asterisks(*), the hash symbols(#), the hyphens(-), and the alphabet(L). - Each asterisk represents a WI-FI hotspot. - Each hash symbol represents an obstacle. - Each hyphen represents empty space. - Each alphabet L represents a laptop. Each laptop has a special feature of connecting to any Wi-Fi network from any distance away, as long as there are not any obstructions between the hotspot and the laptop. For each laptop, the program must print the number of WI-FI hotspots that the laptop can connect as the output. Note: The alphabet L always occurs at least once in the string. Boundary Condition(s): 1 <= Length of S <= 100 Input Format: The first line contains S. Output Format: The first line contains the integer values representing the number of WI-FI hotspots that the laptop can connect. Example Input/Output 1: Input: ( ) *---L--*---* Output: ...

Matrix - Identical Row and Column

Image
Matrix - Identical Row and Column  PROBLEM STATEMENT : The program must accept an integer matrix of size N*N as the input. The program must print YES if at least one row is identical to one column in the given matrix. Else the program must print NO as the output.  Boundary Condition(s):   2 <= N <= 50  1 <= Matrix element value <= 1000  Input Format:   The first line contains N.  The next N lines, each contain N integers separated by a space.  Output Format:  The first line contains YES or NO.  Explanation:  Example Input/Output 3: Input:  Output: NO Example Input/Output 1: Input: ( ) 4 2 3 4 5 3 5 10 9 6 10 8 8 7 9 2 1 Output: YES Explanation:  2nd row and 2nd column of the given matrix are identical.  2 3 4 5  3 5 10 9  6 10 8 8  7 9 2 1  So YES is printed as the output. Example Input/Output 2: Input: ( ) 3 4 5 3 1 3 3 4 5 1 Output: YES Explanation: ...