Skip to content

Commit

Permalink
Improved tasks 11, 31, 34, 35, 41, 45, 46, 53, 295
Browse files Browse the repository at this point in the history
  • Loading branch information
javadev authored Jan 11, 2024
1 parent 2c657aa commit e9e41b1
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ namespace LeetCodeNet.G0001_0100.S0011_container_with_most_water {

// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Array #Greedy #Two_Pointers
// #Algorithm_II_Day_4_Two_Pointers #Big_O_Time_O(n)_Space_O(1)
// #2023_12_26_Time_248_ms_(11.15%)_Space_62.1_MB_(5.59%)
// #2024_01_11_Time_251_ms_(30.70%)_Space_61.5_MB_(26.65%)

public class Solution {
public int MaxArea(int[] height) {
int maxArea = -1;
int left = 0;
int right = height.Length - 1;

while (left < right) {
if (height[left] < height[right]) {
maxArea = Math.Max(maxArea, height[left] * (right - left));
Expand All @@ -19,7 +18,6 @@ public int MaxArea(int[] height) {
right--;
}
}

return maxArea;
}
}
Expand Down
2 changes: 1 addition & 1 deletion LeetCodeNet/G0001_0100/S0031_next_permutation/Solution.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace LeetCodeNet.G0001_0100.S0031_next_permutation {

// #Medium #Top_100_Liked_Questions #Array #Two_Pointers #Big_O_Time_O(n)_Space_O(1)
// #2023_12_28_Time_202_ms_(5.19%)_Space_46.2_MB_(5.39%)
// #2024_01_11_Time_98_ms_(94.17%)_Space_46_MB_(24.35%)

public class Solution {
public void NextPermutation(int[] nums) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace LeetCodeNet.G0001_0100.S0034_find_first_and_last_position_of_element_i

// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Array #Binary_Search
// #Algorithm_II_Day_1_Binary_Search #Binary_Search_I_Day_5 #Big_O_Time_O(log_n)_Space_O(1)
// #2023_12_28_Time_171_ms_(5.87%)_Space_48.4_MB_(5.63%)
// #2024_01_11_Time_120_ms_(81.66%)_Space_48.8_MB_(8.72%)

public class Solution {
public int[] SearchRange(int[] nums, int target) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace LeetCodeNet.G0001_0100.S0035_search_insert_position {

// #Easy #Top_100_Liked_Questions #Array #Binary_Search #Algorithm_I_Day_1_Binary_Search
// #Binary_Search_I_Day_2 #Big_O_Time_O(log_n)_Space_O(1)
// #2023_12_28_Time_106_ms_(6.17%)_Space_42_MB_(5.47%)
// #2024_01_11_Time_64_ms_(95.18%)_Space_41.4_MB_(28.65%)

public class Solution {
public int SearchInsert(int[] nums, int target) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace LeetCodeNet.G0001_0100.S0041_first_missing_positive {

// #Hard #Top_100_Liked_Questions #Top_Interview_Questions #Array #Hash_Table #Udemy_Arrays
// #Big_O_Time_O(n)_Space_O(n) #2023_12_28_Time_192_ms_(13.98%)_Space_57.8_MB_(13.98%)
// #Big_O_Time_O(n)_Space_O(n) #2024_01_11_Time_178_ms_(36.64%)_Space_57.6_MB_(32.67%)

public class Solution {
public int FirstMissingPositive(int[] nums) {
Expand Down
2 changes: 1 addition & 1 deletion LeetCodeNet/G0001_0100/S0045_jump_game_ii/Solution.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace LeetCodeNet.G0001_0100.S0045_jump_game_ii {

// #Medium #Top_100_Liked_Questions #Array #Dynamic_Programming #Greedy
// #Algorithm_II_Day_13_Dynamic_Programming #Dynamic_Programming_I_Day_4
// #Big_O_Time_O(n)_Space_O(1) #2023_12_28_Time_144_ms_(15.35%)_Space_44_MB_(16.51%)
// #Big_O_Time_O(n)_Space_O(1) #2024_01_11_Time_85_ms_(88.80%)_Space_44.1_MB_(33.81%)

public class Solution {
public int Jump(int[] nums) {
Expand Down
2 changes: 1 addition & 1 deletion LeetCodeNet/G0001_0100/S0046_permutations/Solution.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace LeetCodeNet.G0001_0100.S0046_permutations {
// #Medium #Top_100_Liked_Questions #Top_Interview_Questions #Array #Backtracking
// #Algorithm_I_Day_11_Recursion_Backtracking #Level_2_Day_20_Brute_Force/Backtracking
// #Udemy_Backtracking/Recursion #Big_O_Time_O(n*n!)_Space_O(n+n!)
// #2023_12_28_Time_148_ms_(5.56%)_Space_45.8_MB_(8.50%)
// #2024_01_11_Time_96_ms_(96.56%)_Space_46.4_MB_(12.40%)

using System.Collections.Generic;

Expand Down
2 changes: 1 addition & 1 deletion LeetCodeNet/G0001_0100/S0053_maximum_subarray/Solution.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace LeetCodeNet.G0001_0100.S0053_maximum_subarray {
// #Easy #Top_100_Liked_Questions #Top_Interview_Questions #Array #Dynamic_Programming
// #Divide_and_Conquer #Data_Structure_I_Day_1_Array #Dynamic_Programming_I_Day_5
// #Udemy_Famous_Algorithm #Big_O_Time_O(n)_Space_O(1)
// #2024_01_04_Time_276_ms_(20.05%)_Space_62.4_MB_(8.46%)
// #2024_01_11_Time_270_ms_(38.35%)_Space_62.7_MB_(7.88%)

public class Solution {
public int MaxSubArray(int[] nums) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace LeetCodeNet.G0201_0300.S0295_find_median_from_data_stream {

// #Hard #Top_100_Liked_Questions #Top_Interview_Questions #Sorting #Two_Pointers #Design
// #Heap_Priority_Queue #Data_Stream #Big_O_Time_O(n*log_n)_Space_O(n)
// #2024_01_07_Time_642_ms_(21.62%)_Space_142.7_MB_(6.39%)
// #2024_01_11_Time_658_ms_(24.88%)_Space_144_MB_(5.64%)

using System;
using System.Collections.Generic;
Expand Down
46 changes: 23 additions & 23 deletions README.md

Large diffs are not rendered by default.

0 comments on commit e9e41b1

Please sign in to comment.