Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

missing integer c#

public int solution(int[] A)
    {
        var val = new HashSet<int>(A).Where(x => x >= 1).OrderBy((y) =>y).ToArray();
        var minval = 1;
        for (int i = 0; i < val.Length; i++)
        {
            if (minval < val[i])
            {
                return minval;
            }
            minval = val[i] + 1;
        }

        return minval;
    }
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# string with double quotes inside 
Csharp :: anidate bucle in c# 
Csharp :: unity 3d animator live link 
Csharp :: C# if with obj params 
Csharp :: How Many Vowels 
Csharp :: c# decimal literal 
Csharp :: c# fill values of child from parent 
Csharp :: Get dwgexport setting reivit api 
Csharp :: unity 3d fire shoting 
Csharp :: create expression func c# for use in where clause 
Csharp :: file.deletealltext 
Csharp :: trimend c# 
Csharp :: moment script unity 
Csharp :: how to split string into a list ignoring number of spaces c# 
Csharp :: touch screen to world point 
Csharp :: Find Center Of Transforms, Points, Multiple Objects 
Csharp :: unity remove all child 
Csharp :: unity custom editor draw line in scene 
Csharp :: visual studio private field underscore 
Csharp :: c# instantiation 
Csharp :: C# Blocks without statements 
Csharp :: start wpf application when windows start 
Csharp :: hdrp lit change emmision values 
Csharp :: dfgf 
Csharp :: html tag inside razor tag 
Csharp :: Remove tabpage by key 
Csharp :: boucle C# 
Csharp :: fixed angle unity 
Csharp :: Compiling C# Example 
Csharp :: c# get digits from int 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =