Annulleret

c# program with unit testing

Please write a maintainable solution for the question on page 2, using the rules given below:

The solution must be written in C#.

You will be given a triangle input (which is a directed graph) and you need to find the path that

provides the maximum possible sum of the numbers per the given rules below:

1. You will start from the top and move downwards to the last possible node.

2. You must proceed by changing between even and odd numbers subsequently. Suppose that

you are on an even number, the next number you choose must be odd, or if you are on an

odd number the next number must be even. In other words, the final path would be Odd ->

even -> odd -> even …

3. You must reach to the bottom of the pyramid.

4. Assume that there is at least one valid path to the bottom.

5. If there are multiple paths, which result in the same maximum amount, you can choose any

of them.

Sample Input:

1

8 9

1 5 9

4 5 2 3

Output:

Max sum: 16

Path: 1, 8, 5, 2

Explanation:

As you can see this triangle has several paths: 1->8->5->2, 1->9->9->3, 1->8->1->4, etc.

The correct answer is 1 + 8 + 5 + 2 = 16. Because since 1 (top most number) is odd we cannot step

onto 9 because 9 is an odd number too. The only number we can move to is 8. From 8 we can step

to 1 or 5. Only 1 -> 8 -> 5 -> 2 sequence gives us the maximum sum. The other path 1-> 8 -> 1 -> 4 is

also a valid path but it sums up to 14. Since 16 is greater than 14, 16 is the solution. Also, note that

the solution is in the form of odd > even > odd > even.

Evner: .NET, C# Programmering

Se mere: write a c program to accept 10 or more numbers then display the numbers in two columns one column with the numbers as they were , write a C program, write a c++ program to accept 10 or more numbers then: display the numbers in two columns: one column with the numbers as they w, write c program online, write c program, write c++ program online, write a c program which can find the root of any function using secanet method, Write a C++ program to assign courses (for final exams) to students such that no student will have two finals scheduled at the s, Write a c# program in the next 30-60 min, write c# program, unit testing c# visual studio 2017, unit testing c#, unit testing c# example, unit testing c# visual studio 2015, visual studio unit testing c++, unit testing in c# for beginners, sqlite unit testing c#, xcode unit testing objective c, unit testing best practices c#, c++ program to find shortest path in graph

Om arbejdsgiveren:
( 0 bedømmelser ) Bengaluru, India

Projekt ID: #21922321

1 freelancer byder i gennemsnit ₹750 på dette job

AbdulBasitAli045

Hi, Contact Me for Quality Work. relevant skills i have: C# / vb.net / .NET Core / SQl Server / HTML / CSS / Bootstrap Thank You and i look forward to the opportunity to work with you.

₹750 INR in 2 dage
(25 bedømmelser)
4.1