Link to this problem: www.hackerrank... Have a better way of doing this? Comment below!
Пікірлер: 13
@annagoyal72484 жыл бұрын
what an amazing way to solve and lovely thinking process shown... please keep making more videos- you are doing great work for future generation.. and me who loves to learn new ways of thinking.. ;-)
@XpLoeRe5 жыл бұрын
Learning alot from you man!
@justaboutanything85063 жыл бұрын
please keep posting more videos, I like them.
@brijeshrajput68545 жыл бұрын
keep going on!
@0z2ae3 жыл бұрын
your vids are really helpful. thx.
@jordanguada43544 жыл бұрын
I was so stuck on this question for a few hours and didn't know I needed to convert it due to the constraints of the data type. I can guess instead of doing that expression of (x => (long)x) for each value in the array... could you also do a for loop to convert them? I appreciate you for making this video
@jordanguada43544 жыл бұрын
Just tested it. The solution works below! for (int i = 0; i < arr.Length - 1; ++i) { x1 += (long)arr[i]; } for (int i = 1; i < arr.Length; ++i) { x2 += (long)arr[i]; } I've been learning C in school for undergrad so I'm used to doing it the long way but I'll get used to the tricks soon. Cheeeers!
@mentallyrecursive13944 жыл бұрын
Nice, C is what I mostly used in school being technically a CE major not CS. It is the language Linus Torvalds created the universe in ;)
@yokoshi12 жыл бұрын
bruh you're using int[] ~ how would i do this exact thing using List
@АкериусМенетил-в6ю2 жыл бұрын
All u need to change is from Array.Sort(arr); to arr.Sort();