We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
usingSystem;usingSystem.Collections.Generic;usingSystem.IO;usingSystem.Linq;usingSystem.Numerics;classSolution{staticvoidMain(String[]args){string[]tokens_n=Console.ReadLine().Split(' ');intn=Convert.ToInt32(tokens_n[0]);intm=Convert.ToInt32(tokens_n[1]);// Instantiate and populate an array of size NBigInteger[]arr=newBigInteger[n];for(inti=0;i<n;i++)arr[i]=0;for(inta0=0;a0<m;a0++){string[]tokens_a=Console.ReadLine().Split(' ');inta=Convert.ToInt32(tokens_a[0]);intb=Convert.ToInt32(tokens_a[1]);intk=Convert.ToInt32(tokens_a[2]);// Apply operationfor(intj=a-1;j<b;j++)arr[j]+=k;}Console.WriteLine(arr.Max(i=>i));}}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Array Manipulation
You are viewing a single comment's thread. Return to all comments →
How is your method faster than the following?