Flipkart coding test problem... Need help [update: Solved]

Revision en8, by Rock2000, 2020-09-04 16:42:21

I appeared for Flipkart coding test day before yesterday and got stuck on this problem:
You are given an undirected weighted graph with n vertices and m edges. In one move you can make any edge weight zero. You can perform atmost K moves. You have to tell what is the shortest path from a starting node A to an ending node B after performing atmost K moves.
1<=n<=1000
0<=K<n
1<=m<=10000
1<=w<=10^9 (weight of edge)
Can anybody please tell me how to approach this problem?
I found this problem on quora also but couldn't understand the approach clearly.
[UPD]: This problem has been solved thanks to ExplodingFreeze and _dobby_

Code
Tags #flipkart, #help

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en8 English Rock2000 2020-09-04 16:42:21 40
en7 English Rock2000 2020-09-04 16:34:34 3013
en6 English Rock2000 2020-09-04 13:53:32 12 Tiny change: '1000<br>\n1<=m' -> '1000<br>\n0<=K<n<br>\n1<=m'
en5 English Rock2000 2020-09-04 11:11:13 5 Tiny change: 'u have to out what is t' -> 'u have to tell what is t'
en4 English Rock2000 2020-09-04 11:08:52 93
en3 English Rock2000 2020-09-04 11:06:41 5 Tiny change: 'm-1-to-N) but could' -> 'm-1-to-N) also but could'
en2 English Rock2000 2020-09-04 11:05:06 231
en1 English Rock2000 2020-09-04 10:58:21 438 Initial revision (published)