Detail Form
We will send your result on your email id and phone no. please fill detail
Given a string S, the task is to create a string with the first letter of every word in the string.
Example 1:
Example 2:
Your Task:
You don't need to read input or print anything. Your task is to complete the function firstAlphabet
() which takes string S as input parameter and returns a string that contains the first letter of every word in S.
Expected Time Complexity: O(|S|)
Expected Auxiliary Space: O(|S|)
Constraints:
1 <= |S| <= 105
S contains lower case English alphabets
Words have a single space between them.
A beautiful matrix is a matrix in which the sum of elements in each row and column is equal.
Given a square matrix of size NxN. Find the minimum number of operation(s) that are required to make the matrix beautiful. In one operation you can increment the value of any one cell by 1.
Example 1:
Example 2:
Your Task:
You don't need to read input or print anything. Complete the function findMinOpeartion() that takes matrix and n as input parameters and returns the minimum number of operations.
Expected Time Complexity: O(N * N)
Expected Auxiliary Space: O(N)
Constraints:
1 <= N <= 100
1 <= matrix[i][j] <= 200
Given a square matrix of size N*N, print the sum of upper and lower triangular elements. Upper Triangle consists of elements on the diagonal and above it. The lower triangle consists of elements on the diagonal and below it.
Example 1:
Example 2:
Your Task:
You don't need to read input or print anything. Complete the function sumTriangles() that takes matrix and its size N as input parameters and returns the list of integers containing the sum of upper and lower triangle.
Expected Time Complexity: O(N * N)
Expected Auxiliary Space: O(1)
Constraints:
1 <= N <= 100
1 <= matrix[i][j] <= 100