Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A Hackerrank Challenge: Given an NxN matrix, slice it and find the minimum slice weight. A slice consists of all the elements that are below,

A Hackerrank Challenge:

Given an NxN matrix, slice it and find the minimum slice weight.

A slice consists of all the elements that are below, below right, or below left of the element above it. The Min Slice Weight is the minimum sum of all elements in the slice.

Example: given input

1 2 3

4 5 6

7 8 9

The slices would be 1 4 7 1; 1 4 8; 1 5 7; 1 5 8; 1 5 9; 2 4 7; 2 4 8; 2 5 8; 2 5 9;2 6 8; 2 6 9 ....etc.

KEEP IN MIND THAT THE MATRIX IS NOT 3 X 3, BUT N X N.

The minimum slice would be 1 4 7 in this case because 1+4+7 is the minimum of all the sums;

Write a function public int FindMinSlice (List> Matrix) that returns the min slice weight.

NOTE: Psuedocode is accepted. I want to know the approach of solving this question.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

XML Data Management Native XML And XML Enabled Database Systems

Authors: Akmal Chaudhri, Awais Rashid, Roberto Zicari, John Fuller

1st Edition

0201844524, 978-0201844528

More Books

Students also viewed these Databases questions

Question

1. Identify three approaches to culture.

Answered: 1 week ago

Question

Need Help with Filling in grey areas

Answered: 1 week ago