Files
LeetCode-Questions-CompanyWise/indeed_2year.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

25 lines
2.6 KiB
CSV

ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
811,Subdomain Visit Count,69.9%,Easy,1.538307489545883, https://leetcode.com/problems/subdomain-visit-count
224,Basic Calculator,36.8%,Hard,1.1373983137032662, https://leetcode.com/problems/basic-calculator
770,Basic Calculator IV,48.1%,Hard,0.9582549309731873, https://leetcode.com/problems/basic-calculator-iv
718,Maximum Length of Repeated Subarray,49.4%,Medium,0.6258730735252086, https://leetcode.com/problems/maximum-length-of-repeated-subarray
68,Text Justification,27.7%,Hard,0.22496389768259162, https://leetcode.com/problems/text-justification
228,Summary Ranges,39.5%,Medium,0.1207191114343526, https://leetcode.com/problems/summary-ranges
362,Design Hit Counter,63.7%,Medium,0.09787757530957068, https://leetcode.com/problems/design-hit-counter
85,Maximal Rectangle,37.7%,Hard,0.0805588367172521, https://leetcode.com/problems/maximal-rectangle
346,Moving Average from Data Stream,70.9%,Easy,0.06887402901251127, https://leetcode.com/problems/moving-average-from-data-stream
1197,Minimum Knight Moves,36.1%,Medium,0.06562120535847293, https://leetcode.com/problems/minimum-knight-moves
829,Consecutive Numbers Sum,37.5%,Hard,0.05341723749698583, https://leetcode.com/problems/consecutive-numbers-sum
380,Insert Delete GetRandom O(1),47.5%,Medium,0.038717635350707984, https://leetcode.com/problems/insert-delete-getrandom-o1
563,Binary Tree Tilt,48.7%,Easy,0.030443751414723153, https://leetcode.com/problems/binary-tree-tilt
349,Intersection of Two Arrays,62.5%,Easy,0.028691227482495342, https://leetcode.com/problems/intersection-of-two-arrays
227,Basic Calculator II,36.9%,Medium,0.027685557859864054, https://leetcode.com/problems/basic-calculator-ii
23,Merge k Sorted Lists,40.2%,Hard,0.016108271385328228, https://leetcode.com/problems/merge-k-sorted-lists
21,Merge Two Sorted Lists,53.5%,Easy,0.014012111332134735, https://leetcode.com/problems/merge-two-sorted-lists
724,Find Pivot Index,44.0%,Easy,0.013850636933899008, https://leetcode.com/problems/find-pivot-index
1143,Longest Common Subsequence,58.4%,Medium,0.008835931134362285, https://leetcode.com/problems/longest-common-subsequence
297,Serialize and Deserialize Binary Tree,47.5%,Hard,0.007077170374085099, https://leetcode.com/problems/serialize-and-deserialize-binary-tree
1,Two Sum,45.6%,Easy,0.0051178232035212715, https://leetcode.com/problems/two-sum
560,Subarray Sum Equals K,43.9%,Medium,0.004279454482267064, https://leetcode.com/problems/subarray-sum-equals-k
88,Merge Sorted Array,39.4%,Easy,0.0030102370714243072, https://leetcode.com/problems/merge-sorted-array