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.
i had to alter the main func generated by HR, cause the original func try to convert the input (given by HR) values of the list in 32bits value, but some outputs is bigger than 32b. so, i alter the method "Convert.ToInt32" for "Convert.ToInt64". after, the code pass.
the question is: should i change the main function in some exercises?
i dont know if the ex is not working correctly, if i cheated the ex
or if I just did what was supposed to be done.
can someone help me?
obs: the parameter of my func is changed from "List int" (generated by HR) for "List long"
usingSystem.CodeDom.Compiler;usingSystem.Collections.Generic;usingSystem.Collections;usingSystem.ComponentModel;usingSystem.Diagnostics.CodeAnalysis;usingSystem.Globalization;usingSystem.IO;usingSystem.Linq;usingSystem.Reflection;usingSystem.Runtime.Serialization;usingSystem.Text.RegularExpressions;usingSystem.Text;usingSystem;classResult{/* * Complete the 'miniMaxSum' function below. * * The function accepts INTEGER_ARRAY arr as parameter. */publicstaticvoidminiMaxSum(List<long>arr){longmin=arr.Min();longmax=arr.Max();longsum=arr.Sum();Console.WriteLine($"{sum - max} {sum - min}");}}classSolution{publicstaticvoidMain(string[]args){List<long>arr=Console.ReadLine().TrimEnd().Split(' ').ToList().Select(arrTemp=>Convert.ToInt64(arrTemp)).ToList();Result.miniMaxSum(arr);}}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Mini-Max Sum
You are viewing a single comment's thread. Return to all comments →
i have a question.
i had to alter the main func generated by HR, cause the original func try to convert the input (given by HR) values of the list in 32bits value, but some outputs is bigger than 32b. so, i alter the method "Convert.ToInt32" for "Convert.ToInt64". after, the code pass.
the question is: should i change the main function in some exercises?
i dont know if the ex is not working correctly, if i cheated the ex or if I just did what was supposed to be done.
can someone help me?
obs: the parameter of my func is changed from "List int" (generated by HR) for "List long"