Delete Columns to Make Sorted LeetCode Challenge

📅 Day 43 of #100DaysOfLeetCode 🧩 Problem: 944. Delete Columns to Make Sorted ⚡ Difficulty: Easy 🚀 What I learned today: Visualized the input as a grid of characters (row-wise strings, column-wise comparison) Iterated column by column and checked if characters are lexicographically sorted top to bottom As soon as a column violates sorting (strs[i][j] < strs[i-1][j]), it must be deleted Early break optimization avoids unnecessary comparisons 🧠 Approach: Loop through each column Compare adjacent rows in that column Count columns where the order is not non-decreasing ⏱️ Complexity: Time: O(n × m) Space: O(1) #LeetCode #Java #ProblemSolving #CodingChallenge #100DaysOfCode #DSA #LearningEveryday

  • text

To view or add a comment, sign in

Explore content categories