
Hello, Folks Welcome to CodeScript. In this article, I will discuss the coding questions that were asked in Accenture Associate Software Engineer Hiring on 19 August.
There were two questions in the coding round test. I have listed all questions below.
1. Straight Line or 0:
Statement:
Given a set of points in a plane, check whether the points lie on a straight line or not. If they lie on a straight line returns the equation else returns 0.
Input Format:
First Input: First Line contains no. of points in the plane.
Second Input: The second line contains x,y coordinates of all the points which are divided with spaces.
Output Format:
Equation of the line (str) if the points lie on a plane or 0(str).
Sample Input:
3
1 1 2 2 3 3
Output:
1x-1y=0
Explanation:
The three points here are [1,1],[2,2] and [3,3]. These lie on a line so it returned the equation.
Solution:
Must Watch:
Accenture Interview Experience July – 2021 CSE Student | Accenture Freshers Interview
2. Step Game
This is a game where there are steps numbered from 0 to the n steps. You will be on the nth step on the start of the game. your goal to reach the 0th step at the end ogf the game with a minimum no of jumps.
If the given step’s number is even you are allowed to jump n/2 steps below ate maximum and if the step no. is odd you are allowed to jump 1 step below. Now find the win this game from the given input.
Sample Input:
10
Output
5
Explanation:
10->5 jump – 1
5->4 jump – 2
4->2 jump – 3
2->1 jump – 4
1->0 jump – 5