C
C#2mo ago
NikkSazz

Decrease all of arrays by 1, optimization because of Time limit Exeeded

Hi I want a code to reduce all ints in int[] happiness, exept for zeros to stay. I was wondering if it was possible to see if all Items left in the array are zero or if all items left in the array are not greater than zero if that makes sense.
No description
3 Replies
Angius
Angius2mo ago
What you have here should be fine Not sure what that IndexOf is doing there But what you have should be performant and perfectly fine
NikkSazz
NikkSazz2mo ago
I understand the code works, the && is used to optimise a little bit? idk man i redid the code i thought that entire part is useless
Angius
Angius2mo ago
Seeing how && short-circuits, no, I don't think it's much of an improvement
Want results from more Discord servers?
Add your server
More Posts
✅ Difference between explicit and implicit operatorsHello there. What's the difference between defining an implicit and explicit operator? I would likresource dictionary confusionSo this is a really weird question, so bear with me as I'm gonna try explaining. I am building a WPFWhat is the equivalent of this react component if made using C# and Blazor?I'm used to just doing .NET + React, but since they improved Blazor so much with .net 8 I'm having sApplication memory keeps increasingI have an application whose memory usage keeps increasing. The obvious thought is that I have a memoServe SPA (React) in ASP.NET web APIIs it a correct way to serve SPA in ASP.NET Web API project? Is there a better way to do it? The wayHow can i detect a new e-mail arrival using GraphClientServerI'm using Microsoft's outlook service through their graph library `Microsoft.Graph.` I make a login Concern over inheritance with static interface methodsConsider the following interface: ```cs public interface ILuaModel { static abstract void SetUseResolving External Components with Nested Components in NSwag for OpenAPI specsI am using NSwag to generate a C# client from an OpenAPI spec I want this spec to reference an exteLooking for help with database injection in NinjaTrader - Advanced(I think)I'm using NinjaTrader to build a fully automated trading bot. Right now the issue I'm having is thatHow to set Object from Inherited class with ReflectionsIm working on a framework for one of my libraries and my goal is to create a similar structure as Di