Get best answers to any doubt/query/question related to programming , jobs, gate, internships and tech-companies. Feel free to ask a question and you will receive the best advice/suggestion related to anything you ask about software-engineering , development and programming problems .

0 like 0 dislike
1,403 views

For proper oa or interview experiences list of all top tech companies visit :

https://oa.desiqna.in

https://interview.desiqna.in

 

image

 

in Online Assessments by Expert (44,360 points)

2 Answers

0 like 0 dislike
 
Best answer

Construction Management
A construction company is building a new neighborhood and they are currently working on design. Each house will be built using one of three main materials but not side-by-side hiuses can be made of same material. because each hose will be varying size and complexity,  the cost of materials for each house varies. Given the cost of using each material for each house. what is the minimum cost needed to complete te neighborhood?

 

by Expert (44,360 points)
0 like 0 dislike
Solution: 
int minCost(vector<vector<int>> cost){
	int result =0;
	int r = cost.size();
	for(int i=0; i<n; i++){
		cost[i][0] += min(cost[i-1][1], cost[i-1][2]);
		cost[i][1] += min(cost[i-1][0], cost[i-1][2]);
		cost[i][2] += min(cost[i-1][1], cost[i-1][0]);
	}
	result = min(min(cost[r-1][0], cost[r-1][1]),cost[r-1][2]);
	return result;
}
by Expert (44,360 points)
...