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

32 lines
3.3 KiB
CSV

ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
923,3Sum With Multiplicity,35.7%,Medium,3.6540779400095724, https://leetcode.com/problems/3sum-with-multiplicity
855,Exam Room,43.1%,Medium,2.227706389329833, https://leetcode.com/problems/exam-room
297,Serialize and Deserialize Binary Tree,47.5%,Hard,0.8013348386500929, https://leetcode.com/problems/serialize-and-deserialize-binary-tree
525,Contiguous Array,42.8%,Medium,0.661321343774057, https://leetcode.com/problems/contiguous-array
437,Path Sum III,47.2%,Medium,0.5566603463186759, https://leetcode.com/problems/path-sum-iii
498,Diagonal Traverse,48.2%,Medium,0.3533581913127385, https://leetcode.com/problems/diagonal-traverse
14,Longest Common Prefix,35.4%,Easy,0.276319223139963, https://leetcode.com/problems/longest-common-prefix
253,Meeting Rooms II,45.7%,Medium,0.24508053019079523, https://leetcode.com/problems/meeting-rooms-ii
113,Path Sum II,46.7%,Medium,0.2114436333734406, https://leetcode.com/problems/path-sum-ii
1053,Previous Permutation With One Swap,48.5%,Medium,0.20067069546215116, https://leetcode.com/problems/previous-permutation-with-one-swap
1329,Sort the Matrix Diagonally,78.4%,Medium,0.14787032803970862, https://leetcode.com/problems/sort-the-matrix-diagonally
162,Find Peak Element,43.3%,Medium,0.14169934441669452, https://leetcode.com/problems/find-peak-element
1027,Longest Arithmetic Sequence,53.4%,Medium,0.11122563511022437, https://leetcode.com/problems/longest-arithmetic-sequence
31,Next Permutation,32.6%,Medium,0.11042119699719148, https://leetcode.com/problems/next-permutation
380,Insert Delete GetRandom O(1),47.5%,Medium,0.1088270483839184, https://leetcode.com/problems/insert-delete-getrandom-o1
452,Minimum Number of Arrows to Burst Balloons,49.6%,Medium,0.10828689439229534, https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons
852,Peak Index in a Mountain Array,71.6%,Easy,0.10417042076751157, https://leetcode.com/problems/peak-index-in-a-mountain-array
780,Reaching Points,29.4%,Hard,0.1040197878075301, https://leetcode.com/problems/reaching-points
390,Elimination Game,44.5%,Medium,0.0922312242160336, https://leetcode.com/problems/elimination-game
48,Rotate Image,56.7%,Medium,0.058128316417041546, https://leetcode.com/problems/rotate-image
15,3Sum,26.8%,Medium,0.04132186956190618, https://leetcode.com/problems/3sum
39,Combination Sum,56.1%,Medium,0.033569210052752915, https://leetcode.com/problems/combination-sum
1,Two Sum,45.6%,Easy,0.01579380422752371, https://leetcode.com/problems/two-sum
560,Subarray Sum Equals K,43.9%,Medium,0.00407664649376343, https://leetcode.com/problems/subarray-sum-equals-k
198,House Robber,42.0%,Easy,0.003611415987216383, https://leetcode.com/problems/house-robber
717,1-bit and 2-bit Characters,48.8%,Easy,0, https://leetcode.com/problems/1-bit-and-2-bit-characters
1256,Encode Number,66.1%,Medium,0, https://leetcode.com/problems/encode-number
1281,Subtract the Product and Sum of Digits of an Integer,85.2%,Easy,0, https://leetcode.com/problems/subtract-the-product-and-sum-of-digits-of-an-integer
1295,Find Numbers with Even Number of Digits,81.5%,Easy,0, https://leetcode.com/problems/find-numbers-with-even-number-of-digits
1354,Construct Target Array With Multiple Sums,31.9%,Hard,0, https://leetcode.com/problems/construct-target-array-with-multiple-sums