Udemy: Master Coding Interview - Big O - #28

Run Settings
LanguageC#
Language Version
Run Command
using System; using System.Diagnostics; class MainClass { // static string[] nemo = {"nemo"}; // static string[] everyone = {"dory", "bruce", "marlin", "nemo", "gill", // "bloat", "nigel", "squirt", "darla", "hank"}; // static string[] large; // static string[] larger; // static string[] largest; static int[] boxes = {0, 1, 2, 3, 4, 5}; static void Main() { // large = new string[100]; // Array.Fill(large, "nemo"); // larger = new string[100000]; // Array.Fill(larger, "nemo"); // largest = new string[10000000]; // Array.Fill(largest, "nemo"); // MainClass.findNemo(nemo); // O(n) --> Linear Time // MainClass.findNemo(everyone); // MainClass.findNemo(large); // MainClass.findNemo(larger); // MainClass.findNemo(largest); logFirstTwoBoxes(boxes); // O(2) } // public static void findNemo(string[] array) { // for (int i = 0; i < array.Length; i++) { // if (array[i] == "nemo") { // Console.WriteLine("Found NEMO!"); // } // } // } public static void logFirstTwoBoxes(int[] boxes) { Console.WriteLine(boxes[0]); // O(1) Console.WriteLine(boxes[1]); // O(1) } }
Editor Settings
Theme
Key bindings
Full width
Lines