Files
LeetCode-Questions-CompanyWise/mathworks_1year.csv
Krishna Kumar Dey fb5f78b55e Chore: Add headers to all the files (#54)
## 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)

```
2023-04-01 11:07:49 +05:30

26 lines
2.7 KiB
CSV

ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
1130,Minimum Cost Tree From Leaf Values,66.1%,Medium,1.583844915245196, https://leetcode.com/problems/minimum-cost-tree-from-leaf-values
255,Verify Preorder Sequence in Binary Search Tree,45.7%,Medium,1.0184692951799177, https://leetcode.com/problems/verify-preorder-sequence-in-binary-search-tree
1163,Last Substring in Lexicographical Order,33.9%,Hard,0.9532793012434956, https://leetcode.com/problems/last-substring-in-lexicographical-order
317,Shortest Distance from All Buildings,41.4%,Hard,0.3879036811782171, https://leetcode.com/problems/shortest-distance-from-all-buildings
25,Reverse Nodes in k-Group,42.1%,Hard,0.22841574636360815, https://leetcode.com/problems/reverse-nodes-in-k-group
500,Keyboard Row,64.7%,Easy,0.19290366612449156, https://leetcode.com/problems/keyboard-row
526,Beautiful Arrangement,57.8%,Medium,0.17351092711179975, https://leetcode.com/problems/beautiful-arrangement
206,Reverse Linked List,62.5%,Easy,0.12378418901663191, https://leetcode.com/problems/reverse-linked-list
741,Cherry Pickup,33.9%,Hard,0.12293768624504794, https://leetcode.com/problems/cherry-pickup
259,3Sum Smaller,47.6%,Medium,0.10814850377723753, https://leetcode.com/problems/3sum-smaller
697,Degree of an Array,53.8%,Easy,0.07117627846789498, https://leetcode.com/problems/degree-of-an-array
115,Distinct Subsequences,38.3%,Hard,0.061494781607806234, https://leetcode.com/problems/distinct-subsequences
1319,Number of Operations to Make Network Connected,53.1%,Medium,0.04587960575069364, https://leetcode.com/problems/number-of-operations-to-make-network-connected
232,Implement Queue using Stacks,49.6%,Easy,0.04423053722733957, https://leetcode.com/problems/implement-queue-using-stacks
63,Unique Paths II,34.6%,Medium,0.03440459729940371, https://leetcode.com/problems/unique-paths-ii
62,Unique Paths,54.1%,Medium,0.02853749186115581, https://leetcode.com/problems/unique-paths
338,Counting Bits,69.5%,Medium,0.024325523767440974, https://leetcode.com/problems/counting-bits
49,Group Anagrams,56.9%,Medium,0.02354157682187747, https://leetcode.com/problems/group-anagrams
225,Implement Stack using Queues,45.1%,Easy,0.01644097863345757, https://leetcode.com/problems/implement-stack-using-queues
647,Palindromic Substrings,60.6%,Medium,0.010400509768078022, https://leetcode.com/problems/palindromic-substrings
15,3Sum,26.8%,Medium,0.004940992758742591, https://leetcode.com/problems/3sum
200,Number of Islands,46.8%,Medium,0.0028897578265903614, https://leetcode.com/problems/number-of-islands
20,Valid Parentheses,39.0%,Easy,0.0023005704055949323, https://leetcode.com/problems/valid-parentheses
1,Two Sum,45.6%,Easy,0.00184543512358731, https://leetcode.com/problems/two-sum