Skip to content

Commit

Permalink
Chore: Add headers to all the files (#54)
Browse files Browse the repository at this point in the history
## Description
- Add headers to all the CSV files

## Script used
```py
import csv
import os

# Set the path of the folder containing the CSV files
folder_path = "./LeetCode-Questions-CompanyWise"
headers = [
    "ID",
    "Title",
    "Acceptance",
    "Difficulty",
    "Frequency",
    "Leetcode Question Link",
]

# Loop through all the CSV files in the folder
for file_name in os.listdir(folder_path):
    if file_name.endswith(".csv"):
        # Read the CSV file into a list of rows
        file_path = os.path.join(folder_path, file_name)
        with open(file_path, "r") as f:
            reader = csv.reader(f)
            rows = list(reader)

        has_headers = False
        if len(rows) > 0 and rows[0] == headers:
            has_headers = True

        if not has_headers:
            rows.insert(0, headers)

            # Write the list of rows back to the CSV file
            with open(file_path, "w", newline="") as f:
                writer = csv.writer(f)
                writer.writerows(rows)

```
  • Loading branch information
krishnadey30 authored Apr 1, 2023
1 parent 0aeadbd commit fb5f78b
Show file tree
Hide file tree
Showing 534 changed files with 20,291 additions and 19,757 deletions.
281 changes: 141 additions & 140 deletions adobe_1year.csv

Large diffs are not rendered by default.

457 changes: 229 additions & 228 deletions adobe_2year.csv

Large diffs are not rendered by default.

157 changes: 79 additions & 78 deletions adobe_6months.csv

Large diffs are not rendered by default.

471 changes: 236 additions & 235 deletions adobe_alltime.csv

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions aetion_2year.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
2,Add Two Numbers,33.9%,Medium,0.001641227730374625, https://leetcode.com/problems/add-two-numbers
1,Two Sum,45.6%,Easy,0.0008206138651873125, https://leetcode.com/problems/two-sum
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
2,Add Two Numbers,33.9%,Medium,0.001641227730374625, https://leetcode.com/problems/add-two-numbers
1,Two Sum,45.6%,Easy,0.0008206138651873125, https://leetcode.com/problems/two-sum
7 changes: 4 additions & 3 deletions aetion_alltime.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
1,Two Sum,45.6%,Easy,0.04892286053064383, https://leetcode.com/problems/two-sum
413,Arithmetic Slices,57.9%,Medium,0.028431197162004825, https://leetcode.com/problems/arithmetic-slices
2,Add Two Numbers,33.9%,Medium,0.020491663368639005, https://leetcode.com/problems/add-two-numbers
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
1,Two Sum,45.6%,Easy,0.04892286053064383, https://leetcode.com/problems/two-sum
413,Arithmetic Slices,57.9%,Medium,0.028431197162004825, https://leetcode.com/problems/arithmetic-slices
2,Add Two Numbers,33.9%,Medium,0.020491663368639005, https://leetcode.com/problems/add-two-numbers
3 changes: 2 additions & 1 deletion affinity_alltime.csv
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
1106,Parsing A Boolean Expression,58.5%,Hard,0, https://leetcode.com/problems/parsing-a-boolean-expression
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
1106,Parsing A Boolean Expression,58.5%,Hard,0, https://leetcode.com/problems/parsing-a-boolean-expression
11 changes: 6 additions & 5 deletions affirm_1year.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
381,Insert Delete GetRandom O(1) - Duplicates allowed,34.1%,Hard,0.10584435094403895, https://leetcode.com/problems/insert-delete-getrandom-o1-duplicates-allowed
380,Insert Delete GetRandom O(1),47.5%,Medium,0.057001980519332376, https://leetcode.com/problems/insert-delete-getrandom-o1
49,Group Anagrams,56.9%,Medium,0.008159610094625805, https://leetcode.com/problems/group-anagrams
42,Trapping Rain Water,48.9%,Hard,0.00411947029523883, https://leetcode.com/problems/trapping-rain-water
322,Coin Change,35.5%,Medium,0.003863246064215582, https://leetcode.com/problems/coin-change
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
381,Insert Delete GetRandom O(1) - Duplicates allowed,34.1%,Hard,0.10584435094403895, https://leetcode.com/problems/insert-delete-getrandom-o1-duplicates-allowed
380,Insert Delete GetRandom O(1),47.5%,Medium,0.057001980519332376, https://leetcode.com/problems/insert-delete-getrandom-o1
49,Group Anagrams,56.9%,Medium,0.008159610094625805, https://leetcode.com/problems/group-anagrams
42,Trapping Rain Water,48.9%,Hard,0.00411947029523883, https://leetcode.com/problems/trapping-rain-water
322,Coin Change,35.5%,Medium,0.003863246064215582, https://leetcode.com/problems/coin-change
25 changes: 13 additions & 12 deletions affirm_2year.csv
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
736,Parse Lisp Expression,47.5%,Hard,0.7290367865107017, https://leetcode.com/problems/parse-lisp-expression
381,Insert Delete GetRandom O(1) - Duplicates allowed,34.1%,Hard,0.49586980740929654, https://leetcode.com/problems/insert-delete-getrandom-o1-duplicates-allowed
695,Max Area of Island,62.7%,Medium,0.31425595727716876, https://leetcode.com/problems/max-area-of-island
380,Insert Delete GetRandom O(1),47.5%,Medium,0.08108897817576358, https://leetcode.com/problems/insert-delete-getrandom-o1
49,Group Anagrams,56.9%,Medium,0.05662724563684648, https://leetcode.com/problems/group-anagrams
200,Number of Islands,46.8%,Medium,0.033359117749874545, https://leetcode.com/problems/number-of-islands
362,Design Hit Counter,63.7%,Medium,0.024317307650706343, https://leetcode.com/problems/design-hit-counter
322,Coin Change,35.5%,Medium,0.008671409957551127, https://leetcode.com/problems/coin-change
230,Kth Smallest Element in a BST,60.2%,Medium,0.006085520073802784, https://leetcode.com/problems/kth-smallest-element-in-a-bst
127,Word Ladder,29.6%,Medium,0.005731495844689608, https://leetcode.com/problems/word-ladder
42,Trapping Rain Water,48.9%,Hard,0.00411947029523883, https://leetcode.com/problems/trapping-rain-water
1,Two Sum,45.6%,Easy,0.003139596786381058, https://leetcode.com/problems/two-sum
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
736,Parse Lisp Expression,47.5%,Hard,0.7290367865107017, https://leetcode.com/problems/parse-lisp-expression
381,Insert Delete GetRandom O(1) - Duplicates allowed,34.1%,Hard,0.49586980740929654, https://leetcode.com/problems/insert-delete-getrandom-o1-duplicates-allowed
695,Max Area of Island,62.7%,Medium,0.31425595727716876, https://leetcode.com/problems/max-area-of-island
380,Insert Delete GetRandom O(1),47.5%,Medium,0.08108897817576358, https://leetcode.com/problems/insert-delete-getrandom-o1
49,Group Anagrams,56.9%,Medium,0.05662724563684648, https://leetcode.com/problems/group-anagrams
200,Number of Islands,46.8%,Medium,0.033359117749874545, https://leetcode.com/problems/number-of-islands
362,Design Hit Counter,63.7%,Medium,0.024317307650706343, https://leetcode.com/problems/design-hit-counter
322,Coin Change,35.5%,Medium,0.008671409957551127, https://leetcode.com/problems/coin-change
230,Kth Smallest Element in a BST,60.2%,Medium,0.006085520073802784, https://leetcode.com/problems/kth-smallest-element-in-a-bst
127,Word Ladder,29.6%,Medium,0.005731495844689608, https://leetcode.com/problems/word-ladder
42,Trapping Rain Water,48.9%,Hard,0.00411947029523883, https://leetcode.com/problems/trapping-rain-water
1,Two Sum,45.6%,Easy,0.003139596786381058, https://leetcode.com/problems/two-sum
5 changes: 3 additions & 2 deletions affirm_6months.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
381,Insert Delete GetRandom O(1) - Duplicates allowed,34.1%,Hard,0.01868299433822582, https://leetcode.com/problems/insert-delete-getrandom-o1-duplicates-allowed
380,Insert Delete GetRandom O(1),47.5%,Medium,0.00934149716911291, https://leetcode.com/problems/insert-delete-getrandom-o1
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
381,Insert Delete GetRandom O(1) - Duplicates allowed,34.1%,Hard,0.01868299433822582, https://leetcode.com/problems/insert-delete-getrandom-o1-duplicates-allowed
380,Insert Delete GetRandom O(1),47.5%,Medium,0.00934149716911291, https://leetcode.com/problems/insert-delete-getrandom-o1
25 changes: 13 additions & 12 deletions affirm_alltime.csv
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
736,Parse Lisp Expression,47.5%,Hard,1.0065947176467498, https://leetcode.com/problems/parse-lisp-expression
381,Insert Delete GetRandom O(1) - Duplicates allowed,34.1%,Hard,0.6946505634539769, https://leetcode.com/problems/insert-delete-getrandom-o1-duplicates-allowed
695,Max Area of Island,62.7%,Medium,0.5227168031344483, https://leetcode.com/problems/max-area-of-island
380,Insert Delete GetRandom O(1),47.5%,Medium,0.2107726489416756, https://leetcode.com/problems/insert-delete-getrandom-o1
362,Design Hit Counter,63.7%,Medium,0.14310084364067333, https://leetcode.com/problems/design-hit-counter
49,Group Anagrams,56.9%,Medium,0.08712516204977415, https://leetcode.com/problems/group-anagrams
42,Trapping Rain Water,48.9%,Hard,0.08028083126080282, https://leetcode.com/problems/trapping-rain-water
127,Word Ladder,29.6%,Medium,0.06804400933142625, https://leetcode.com/problems/word-ladder
200,Number of Islands,46.8%,Medium,0.05455898425043439, https://leetcode.com/problems/number-of-islands
1,Two Sum,45.6%,Easy,0.04327015683483566, https://leetcode.com/problems/two-sum
322,Coin Change,35.5%,Medium,0.023903996947661692, https://leetcode.com/problems/coin-change
230,Kth Smallest Element in a BST,60.2%,Medium,0.006085520073802784, https://leetcode.com/problems/kth-smallest-element-in-a-bst
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
736,Parse Lisp Expression,47.5%,Hard,1.0065947176467498, https://leetcode.com/problems/parse-lisp-expression
381,Insert Delete GetRandom O(1) - Duplicates allowed,34.1%,Hard,0.6946505634539769, https://leetcode.com/problems/insert-delete-getrandom-o1-duplicates-allowed
695,Max Area of Island,62.7%,Medium,0.5227168031344483, https://leetcode.com/problems/max-area-of-island
380,Insert Delete GetRandom O(1),47.5%,Medium,0.2107726489416756, https://leetcode.com/problems/insert-delete-getrandom-o1
362,Design Hit Counter,63.7%,Medium,0.14310084364067333, https://leetcode.com/problems/design-hit-counter
49,Group Anagrams,56.9%,Medium,0.08712516204977415, https://leetcode.com/problems/group-anagrams
42,Trapping Rain Water,48.9%,Hard,0.08028083126080282, https://leetcode.com/problems/trapping-rain-water
127,Word Ladder,29.6%,Medium,0.06804400933142625, https://leetcode.com/problems/word-ladder
200,Number of Islands,46.8%,Medium,0.05455898425043439, https://leetcode.com/problems/number-of-islands
1,Two Sum,45.6%,Easy,0.04327015683483566, https://leetcode.com/problems/two-sum
322,Coin Change,35.5%,Medium,0.023903996947661692, https://leetcode.com/problems/coin-change
230,Kth Smallest Element in a BST,60.2%,Medium,0.006085520073802784, https://leetcode.com/problems/kth-smallest-element-in-a-bst
43 changes: 22 additions & 21 deletions airbnb_1year.csv
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
755,Pour Water,43.3%,Medium,1.6549959634129805, https://leetcode.com/problems/pour-water
1166,Design File System,56.8%,Medium,1.578042968988746, https://leetcode.com/problems/design-file-system
336,Palindrome Pairs,33.7%,Hard,1.3086247857193076, https://leetcode.com/problems/palindrome-pairs
166,Fraction to Recurring Decimal,21.6%,Medium,1.110416810228655, https://leetcode.com/problems/fraction-to-recurring-decimal
875,Koko Eating Bananas,52.1%,Medium,0.8409986269592165, https://leetcode.com/problems/koko-eating-bananas
773,Sliding Puzzle,59.3%,Hard,0.6810258200276005, https://leetcode.com/problems/sliding-puzzle
864,Shortest Path to Get All Keys,40.1%,Hard,0.6061358035703156, https://leetcode.com/problems/shortest-path-to-get-all-keys
787,Cheapest Flights Within K Stops,39.3%,Medium,0.5212226928497461, https://leetcode.com/problems/cheapest-flights-within-k-stops
269,Alien Dictionary,33.3%,Hard,0.48723106280473205, https://leetcode.com/problems/alien-dictionary
251,Flatten 2D Vector,45.7%,Medium,0.4808790962829651, https://leetcode.com/problems/flatten-2d-vector
1257,Smallest Common Region,58.8%,Medium,0.2561688067457042, https://leetcode.com/problems/smallest-common-region
68,Text Justification,27.7%,Hard,0.16143214434637243, https://leetcode.com/problems/text-justification
1235,Maximum Profit in Job Scheduling,44.0%,Hard,0.1532629744871177, https://leetcode.com/problems/maximum-profit-in-job-scheduling
39,Combination Sum,56.1%,Medium,0.1339254107186325, https://leetcode.com/problems/combination-sum
324,Wiggle Sort II,29.9%,Medium,0.11122563511022437, https://leetcode.com/problems/wiggle-sort-ii
759,Employee Free Time,66.2%,Hard,0.10623186692973738, https://leetcode.com/problems/employee-free-time
280,Wiggle Sort,63.8%,Medium,0.04362742017962607, https://leetcode.com/problems/wiggle-sort
322,Coin Change,35.5%,Medium,0.024924029676386045, https://leetcode.com/problems/coin-change
341,Flatten Nested List Iterator,52.9%,Medium,0.019980684690483426, https://leetcode.com/problems/flatten-nested-list-iterator
236,Lowest Common Ancestor of a Binary Tree,45.7%,Medium,0.004714210262726446, https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree
42,Trapping Rain Water,48.9%,Hard,0.004350670338744988, https://leetcode.com/problems/trapping-rain-water
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
755,Pour Water,43.3%,Medium,1.6549959634129805, https://leetcode.com/problems/pour-water
1166,Design File System,56.8%,Medium,1.578042968988746, https://leetcode.com/problems/design-file-system
336,Palindrome Pairs,33.7%,Hard,1.3086247857193076, https://leetcode.com/problems/palindrome-pairs
166,Fraction to Recurring Decimal,21.6%,Medium,1.110416810228655, https://leetcode.com/problems/fraction-to-recurring-decimal
875,Koko Eating Bananas,52.1%,Medium,0.8409986269592165, https://leetcode.com/problems/koko-eating-bananas
773,Sliding Puzzle,59.3%,Hard,0.6810258200276005, https://leetcode.com/problems/sliding-puzzle
864,Shortest Path to Get All Keys,40.1%,Hard,0.6061358035703156, https://leetcode.com/problems/shortest-path-to-get-all-keys
787,Cheapest Flights Within K Stops,39.3%,Medium,0.5212226928497461, https://leetcode.com/problems/cheapest-flights-within-k-stops
269,Alien Dictionary,33.3%,Hard,0.48723106280473205, https://leetcode.com/problems/alien-dictionary
251,Flatten 2D Vector,45.7%,Medium,0.4808790962829651, https://leetcode.com/problems/flatten-2d-vector
1257,Smallest Common Region,58.8%,Medium,0.2561688067457042, https://leetcode.com/problems/smallest-common-region
68,Text Justification,27.7%,Hard,0.16143214434637243, https://leetcode.com/problems/text-justification
1235,Maximum Profit in Job Scheduling,44.0%,Hard,0.1532629744871177, https://leetcode.com/problems/maximum-profit-in-job-scheduling
39,Combination Sum,56.1%,Medium,0.1339254107186325, https://leetcode.com/problems/combination-sum
324,Wiggle Sort II,29.9%,Medium,0.11122563511022437, https://leetcode.com/problems/wiggle-sort-ii
759,Employee Free Time,66.2%,Hard,0.10623186692973738, https://leetcode.com/problems/employee-free-time
280,Wiggle Sort,63.8%,Medium,0.04362742017962607, https://leetcode.com/problems/wiggle-sort
322,Coin Change,35.5%,Medium,0.024924029676386045, https://leetcode.com/problems/coin-change
341,Flatten Nested List Iterator,52.9%,Medium,0.019980684690483426, https://leetcode.com/problems/flatten-nested-list-iterator
236,Lowest Common Ancestor of a Binary Tree,45.7%,Medium,0.004714210262726446, https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree
42,Trapping Rain Water,48.9%,Hard,0.004350670338744988, https://leetcode.com/problems/trapping-rain-water
Loading

0 comments on commit fb5f78b

Please sign in to comment.