Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Iron, Magnet and Wall Codechef November Long challenge 2020 solution with code explanation

 Iron, Magnet and Wall  Codechef November Long challenge 2020 solution with code explanation -

Iron, Magnet and Wall  Codechef November Long challenge 2020 solution with code explanation 
Let's read problem statement,

Chef loves to play with iron (Fe) and magnets (Ma). He took a row of N cells (numbered 1 through N) and placed some objects in some of these cells. You are given a string S with length N describing them; for each valid i, the i-th character of S is one of the following:

  • 'I' if the i-th cell contains a piece of iron
  • 'M' if the i-th cell contains a magnet
  • '_' if the i-th cell is empty
  • ':' if the i-th cell contains a conducting sheet
  • 'X' if the i-th cell is blocked

If there is a magnet in a cell i and iron in a cell j, the attraction power between these cells is 



This post first appeared on Technical Keeda, please read the originial post: here

Share the post

Iron, Magnet and Wall Codechef November Long challenge 2020 solution with code explanation

×

Subscribe to Technical Keeda

Get updates delivered right to your inbox!

Thank you for your subscription

×