Why use Interview Mocha’s full-stack web developer test?
You can reduce interview time by up to 85% with our full stack web developer test. The full stack web developer coding test can be used to assess candidates on different skill-set. You can use an existing set or request us to make a custom-made skill-set depending on your job requirement.
The full stack web developer skills test helps to screen the candidates who possess traits as follows:
The full stack web developer test can be taken by candidates from anywhere in the comfort of their time zone. Full stack web developer coding test is designed considering EEOC guidelines. It will help you to assess & hire diverse talent without any bias.
Full stack web developer skills test may contain MCQs (Multiple Choice Questions), MAQs (Multiple Answer Questions), Fill in the Blanks, Whiteboard Questions, Audio / Video Questions, etc.
Type Conversion: House of Cards
You and your friends are building several houses of cards. You have N cards in total.
A house of cards is like a pyramidal building.
Hence, a house of cards with a single level will be made of just two cards forming a triangle.
The one with two levels will have four cards forming two triangles at the first level, one card sitting on top of them, and then two cards forming a triangle at the second level.
Thus, it takes 7 cards to build a house of cards with two levels.
Given your N cards, you first try to build the house of cards with the maximum number of levels and then try to build another house with the remaining cards and so on until you have no cards remaining or no more houses can be made.
You need to find out how many houses you can build.
N = 24. Then, you will be able to make a house of three levels with 15 cards, a house of two levels with 7 cards, and a house of one level with 2 cards. Hence, the answer is 3.
You will get inputs as they are from stdin and you will have to typecast them into required types.
In the provided code snippet, implement the provided numHouses(...) method using the variables to print the number of houses you can build. You can write your code in the space below the phrase “WRITE YOUR LOGIC HERE”.
There will be multiple test cases running so the Input and Output should match exactly as provided.
The base Output variable result is set to a default value of -404 which can be modified. Additionally, you can add or remove these output variables.
The first line of the input contains a single integer N, denoting the number of cards.
1 ≤ N ≤ 109
The output format contains a single integer denoting the number of houses you can build.
Here, you will be able to make a house of three levels with 15 cards, a house of two levels with 7 cards, and a house of one level with 2 cards. Hence, the answer is 3.