Posts

GeeksforGeeks 2 October Problem: Enemy

You live in Geek land. Geek land can be seen as a grid of shape  N  x  M . Their are  K  enemy at  K  positions. Each enemy blocks the row and column to which it belongs. You have to find the largest continuous area that is not blocked. No two enemies share the same row or the same column. Example 1: Input: N = 2 M = 2 K = 1 enemy[]={{2,2}} Output: 1 Explanation: Since only (1,1) cell is free from the enemy hence answer is 1. Example 2: Input: N = 3 M = 3 K = 1 enemy[]={{3,3}} Output: 4 Explanation: The cells (1,1),(1,2) ,(2,1) and (2,2) are free hence answer =4. Your Task:   You don't need to read input or print anything. Your task is to complete the function  largestArea()  which takes the size of geek land  n,m  and a 2-D matrix  enemy  of size  k  denoting the coordinates of the enemy's and need to return the largest area that is free. Expected Time Complexity:  O(KlogK) Expected Aux...

Online test under Infosys Recruitment Program #Solution.

Image
The Question Asked By Infosys Recruitment Team:  If you have given number then find the last digit which does not remove(Remaining) when odd places digit remove one by one. the question does not exactly which is asked by Infosys but something like that I have written.   If you have given a Number: 9 [1,2,3,4,5,6,7,8,9]  Remove Odd Places Digit:  [1,2,3,4,5,6,7,8,9,2,4,6,8]  Remove odd Places Digit:  [1,2,3,4,5,6,7,8,9,2,4,6,8,4,8]  Remove odd places Digit:  [1,2,3,4,5,6,7,8,9,2,4,6,8,4,8,8]  The Answer is : 8               Because it is remaining. Explanation: First thing you have given a number. Find the natural number on the given Statement. The given number is 9. Find Natural Number:[1,2,3,4,5,6,7,8]. Remove Odd Places Digit then become new list : [1,2,3,4,5,6,7,8,9,2,4,6,8] this operation can be perform N Times When we find single digit that is the Answer. See Details In the above Example. CAUTION:...

Computer game, This is the Problem statement given in the techgig Platform.

Image
The Problem Statement is Given: Little Vlad is fond of popular computer game Bota-2. Recently, the developers announced the new add-on named Bota-3. Of course, Vlad immediately bought only to find out his computer is too old for the new game and needs to be updated. There are n video cards in the shop, the power of the i-th video card is equal to integer value ai. As Vlad wants to be sure the new game will work he wants to buy not one, but several video cards and unite their powers using the cutting-edge technology. To use this technology one of the cards is chosen as the leading one and other video cards are attached to it as secondary. For this new technology to work it's required that the power of each of the secondary video cards is divisible by the power of the leading video card. In order to achieve that the power of any secondary video card can be reduced to any integer value less or equal than the current power. However, the power of the leading v...

Program to find the area of all faces in irregular tetrahedron, radius of inscribed sphere and Volume of the Tetrahedron.

Image
The all side of an irregular tetrahedron given. The task is to determine the area of its all faces and find radius of inscribed sphere and also find its volume. Let the si de is  d12, d13, d14, d23, d24,d34 . Irregular Tetrahedron Source:Google 3D view of Sphere When we have all side distance given. we use this formula which is given by  Cayley–Menger_determinant.                       Cayley-Menger Determinant To find the volume of irregular tetrahedron use Below formula: Volume^2 = sqrt(V/288)  V=sqrt(4*d12*d12*d13*d13*d14 – d12*(d13*d13 + d14*d14 – d34*d34)^2 – d13*d13(d14*d14 + d12*d12 – d24*d24)^2 – d13*d13(d12*d12 + d13*vd13– d23*d23)^2 + (d12*d12+ d13*d13 – d23*d23) * (d14*d14 + d12*d12 – d24*d24) * (d13*d13 + d14*d14 – d34*d34)) / 12 Formula for volume Is given above. for finding Area of faces use Formula: S1=d1+d2+d4/2 Area1 =sqrt(S*(S-d1)*(S-d2)*(S-d4)) Total Area Of Faces=(A1+A2+A3+A4) Radius Of Sphere=3*Vo...