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

5.0 KiB

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
21168Optimize Water Distribution in a Village60.9%Hard0.15241098168923292https://leetcode.com/problems/optimize-water-distribution-in-a-village
31Two Sum45.6%Easy0.09086581558650506https://leetcode.com/problems/two-sum
4384Shuffle an Array52.8%Medium0.08855339734144506https://leetcode.com/problems/shuffle-an-array
5146LRU Cache33.2%Medium0.027008231238717192https://leetcode.com/problems/lru-cache
611Container With Most Water50.8%Medium0.026255883963365544https://leetcode.com/problems/container-with-most-water
7605Can Place Flowers31.6%Easy0.023502844454782748https://leetcode.com/problems/can-place-flowers
82Add Two Numbers33.9%Medium0.019661976799320476https://leetcode.com/problems/add-two-numbers
960Permutation Sequence38.4%Hard0.019268418865877057https://leetcode.com/problems/permutation-sequence
1075Sort Colors47.3%Medium0.01900520441164089https://leetcode.com/problems/sort-colors
11669Trim a Binary Search Tree63.0%Easy0.01838287060053348https://leetcode.com/problems/trim-a-binary-search-tree
1295Unique Binary Search Trees II40.6%Medium0.016142400559542854https://leetcode.com/problems/unique-binary-search-trees-ii
13178Rank Scores45.8%Medium0.01606460250380669https://leetcode.com/problems/rank-scores
14334Increasing Triplet Subsequence40.0%Medium0.015444322427473612https://leetcode.com/problems/increasing-triplet-subsequence
15215Kth Largest Element in an Array55.4%Medium0.014861874883289309https://leetcode.com/problems/kth-largest-element-in-an-array
1621Merge Two Sorted Lists53.5%Easy0.013412218221408144https://leetcode.com/problems/merge-two-sorted-lists
17131Palindrome Partitioning47.5%Medium0.013236460625830901https://leetcode.com/problems/palindrome-partitioning
18138Copy List with Random Pointer36.4%Medium0.013217992416083225https://leetcode.com/problems/copy-list-with-random-pointer
1913Roman to Integer55.7%Easy0.01303586978808304https://leetcode.com/problems/roman-to-integer
2077Combinations54.7%Medium0.011908446770635425https://leetcode.com/problems/combinations
21518Coin Change 250.2%Medium0.011844971180548993https://leetcode.com/problems/coin-change-2
22445Add Two Numbers II54.5%Medium0.011785640248472312https://leetcode.com/problems/add-two-numbers-ii
23200Number of Islands46.8%Medium0.011015601921505717https://leetcode.com/problems/number-of-islands
2423Merge k Sorted Lists40.2%Hard0.008699909875545938https://leetcode.com/problems/merge-k-sorted-lists
25416Partition Equal Subset Sum43.7%Medium0.008297081408754006https://leetcode.com/problems/partition-equal-subset-sum
261108Defanging an IP Address87.5%Easy0.0070151111959223245https://leetcode.com/problems/defanging-an-ip-address
2733Search in Rotated Sorted Array34.5%Medium0.006961661779487692https://leetcode.com/problems/search-in-rotated-sorted-array
28114Flatten Binary Tree to Linked List49.3%Medium0.00661815784247808https://leetcode.com/problems/flatten-binary-tree-to-linked-list
29448Find All Numbers Disappeared in an Array55.9%Easy0.006552029991300186https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array
30206Reverse Linked List62.5%Easy0.005014496801245667https://leetcode.com/problems/reverse-linked-list
31207Course Schedule43.1%Medium0.004736539346673217https://leetcode.com/problems/course-schedule
32160Intersection of Two Linked Lists40.6%Easy0.00469264117819222https://leetcode.com/problems/intersection-of-two-linked-lists
3353Maximum Subarray46.5%Easy0.004661771624924951https://leetcode.com/problems/maximum-subarray
34169Majority Element58.7%Easy0.004513152193965855https://leetcode.com/problems/majority-element
3522Generate Parentheses62.7%Medium0.004152398782798953https://leetcode.com/problems/generate-parentheses
3642Trapping Rain Water48.9%Hard0.00411947029523883https://leetcode.com/problems/trapping-rain-water
37560Subarray Sum Equals K43.9%Medium0.00407664649376343https://leetcode.com/problems/subarray-sum-equals-k
387Reverse Integer25.8%Easy0.004006593972128933https://leetcode.com/problems/reverse-integer
3946Permutations63.5%Medium0.003984069014874407https://leetcode.com/problems/permutations
404Median of Two Sorted Arrays29.6%Hard0.00371713094107092https://leetcode.com/problems/median-of-two-sorted-arrays
4149Group Anagrams56.9%Medium0.0036347154963361594https://leetcode.com/problems/group-anagrams
42283Move Zeroes57.8%Easy0.002758622439079723https://leetcode.com/problems/move-zeroes
4320Valid Parentheses39.0%Easy0.002197682330605871https://leetcode.com/problems/valid-parentheses
445Longest Palindromic Substring29.5%Medium0.0021771085723255794https://leetcode.com/problems/longest-palindromic-substring
45260Single Number III64.3%Medium0.002022143148991901https://leetcode.com/problems/single-number-iii
463Longest Substring Without Repeating Characters30.4%Medium0.0014852223137141987https://leetcode.com/problems/longest-substring-without-repeating-characters