Files
LeetCode-Questions-CompanyWise/intuit_alltime.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.5 KiB
CSV

ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
811,Subdomain Visit Count,69.9%,Easy,3.0230924503622614, https://leetcode.com/problems/subdomain-visit-count
770,Basic Calculator IV,48.1%,Hard,2.277267285009756, https://leetcode.com/problems/basic-calculator-iv
68,Text Justification,27.7%,Hard,1.8708853641098548, https://leetcode.com/problems/text-justification
224,Basic Calculator,36.8%,Hard,1.204714054955524, https://leetcode.com/problems/basic-calculator
718,Maximum Length of Repeated Subarray,49.4%,Medium,0.45888888960301877, https://leetcode.com/problems/maximum-length-of-repeated-subarray
729,My Calendar I,51.8%,Medium,0.3746934494414107, https://leetcode.com/problems/my-calendar-i
146,LRU Cache,33.2%,Medium,0.3479336801402196, https://leetcode.com/problems/lru-cache
207,Course Schedule,43.1%,Medium,0.27648500804356096, https://leetcode.com/problems/course-schedule
227,Basic Calculator II,36.9%,Medium,0.18200959297922678, https://leetcode.com/problems/basic-calculator-ii
759,Employee Free Time,66.3%,Hard,0.1816986978513639, https://leetcode.com/problems/employee-free-time
79,Word Search,35.6%,Medium,0.16863563907781756, https://leetcode.com/problems/word-search
409,Longest Palindrome,50.3%,Easy,0.1461170580676051, https://leetcode.com/problems/longest-palindrome
1,Two Sum,45.6%,Easy,0.10307155038394701, https://leetcode.com/problems/two-sum
56,Merge Intervals,39.3%,Medium,0.08339552430579078, https://leetcode.com/problems/merge-intervals
210,Course Schedule II,40.7%,Medium,0.07762595476606639, https://leetcode.com/problems/course-schedule-ii
124,Binary Tree Maximum Path Sum,34.3%,Hard,0.06574255262249057, https://leetcode.com/problems/binary-tree-maximum-path-sum
695,Max Area of Island,62.7%,Medium,0.04980799142417255, https://leetcode.com/problems/max-area-of-island
20,Valid Parentheses,39.0%,Easy,0.02782373445001039, https://leetcode.com/problems/valid-parentheses
236,Lowest Common Ancestor of a Binary Tree,45.7%,Medium,0.018724947332324816, https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree
155,Min Stack,44.5%,Easy,0.010653509851791077, https://leetcode.com/problems/min-stack
72,Edit Distance,44.8%,Hard,0.010017614452317782, https://leetcode.com/problems/edit-distance
287,Find the Duplicate Number,55.5%,Medium,0.005501320434837602, https://leetcode.com/problems/find-the-duplicate-number
49,Group Anagrams,56.9%,Medium,0.0038040939835560453, https://leetcode.com/problems/group-anagrams
628,Maximum Product of Three Numbers,47.1%,Easy,0, https://leetcode.com/problems/maximum-product-of-three-numbers