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

12 KiB

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
21Two Sum45.6%Easy0.31908885342700277https://leetcode.com/problems/two-sum
31168Optimize Water Distribution in a Village60.9%Hard0.24224370139848353https://leetcode.com/problems/optimize-water-distribution-in-a-village
4146LRU Cache33.2%Medium0.1653985493699643https://leetcode.com/problems/lru-cache
5384Shuffle an Array52.8%Medium0.08855339734144506https://leetcode.com/problems/shuffle-an-array
6274H-Index36.1%Medium0.07134562063669476https://leetcode.com/problems/h-index
749Group Anagrams56.9%Medium0.07114500702306482https://leetcode.com/problems/group-anagrams
8205Isomorphic Strings39.8%Easy0.06695941113194995https://leetcode.com/problems/isomorphic-strings
995Unique Binary Search Trees II40.6%Medium0.06306265634386511https://leetcode.com/problems/unique-binary-search-trees-ii
1046Permutations63.5%Medium0.06191532308097974https://leetcode.com/problems/permutations
11200Number of Islands46.8%Medium0.05455898425043439https://leetcode.com/problems/number-of-islands
12362Design Hit Counter63.7%Medium0.053905264836202435https://leetcode.com/problems/design-hit-counter
13162Find Peak Element43.3%Medium0.05335388873490833https://leetcode.com/problems/find-peak-element
145Longest Palindromic Substring29.5%Medium0.05305439734187932https://leetcode.com/problems/longest-palindromic-substring
1521Merge Two Sorted Lists53.5%Easy0.05260218626700228https://leetcode.com/problems/merge-two-sorted-lists
16295Find Median from Data Stream44.3%Hard0.05187885241444921https://leetcode.com/problems/find-median-from-data-stream
17416Partition Equal Subset Sum43.7%Medium0.05076201393711222https://leetcode.com/problems/partition-equal-subset-sum
18518Coin Change 250.2%Medium0.04656063549394753https://leetcode.com/problems/coin-change-2
19160Intersection of Two Linked Lists40.6%Easy0.04146148896528119https://leetcode.com/problems/intersection-of-two-linked-lists
20503Next Greater Element II56.5%Medium0.04029193172282132https://leetcode.com/problems/next-greater-element-ii
212Add Two Numbers33.9%Medium0.03972401383463557https://leetcode.com/problems/add-two-numbers
2272Edit Distance44.8%Hard0.037749233217789446https://leetcode.com/problems/edit-distance
2323Merge k Sorted Lists40.2%Hard0.034354523502108394https://leetcode.com/problems/merge-k-sorted-lists
24238Product of Array Except Self60.1%Medium0.03331790689167717https://leetcode.com/problems/product-of-array-except-self
25567Permutation in String44.4%Medium0.03164821095078173https://leetcode.com/problems/permutation-in-string
26222Count Complete Tree Nodes46.8%Medium0.029882701600012697https://leetcode.com/problems/count-complete-tree-nodes
27131Palindrome Partitioning47.5%Medium0.029539397513905316https://leetcode.com/problems/palindrome-partitioning
2875Sort Colors47.3%Medium0.02953900967923939https://leetcode.com/problems/sort-colors
2913Roman to Integer55.7%Easy0.029095312409715624https://leetcode.com/problems/roman-to-integer
30316Remove Duplicate Letters35.8%Hard0.029071814821976905https://leetcode.com/problems/remove-duplicate-letters
31206Reverse Linked List62.5%Easy0.027001860879524588https://leetcode.com/problems/reverse-linked-list
3211Container With Most Water50.8%Medium0.026255883963365544https://leetcode.com/problems/container-with-most-water
33273Integer to English Words27.1%Hard0.025767242936146868https://leetcode.com/problems/integer-to-english-words
3422Generate Parentheses62.7%Medium0.025674032888177357https://leetcode.com/problems/generate-parentheses
35605Can Place Flowers31.6%Easy0.023502844454782748https://leetcode.com/problems/can-place-flowers
36138Copy List with Random Pointer36.4%Medium0.023379206277628954https://leetcode.com/problems/copy-list-with-random-pointer
37108Convert Sorted Array to Binary Search Tree57.9%Easy0.021134058283968957https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree
38212Word Search II34.9%Hard0.021038644146708085https://leetcode.com/problems/word-search-ii
3960Permutation Sequence38.4%Hard0.019268418865877057https://leetcode.com/problems/permutation-sequence
4093Restore IP Addresses35.6%Medium0.01885958774468238https://leetcode.com/problems/restore-ip-addresses
41669Trim a Binary Search Tree63.0%Easy0.01838287060053348https://leetcode.com/problems/trim-a-binary-search-tree
4212Integer to Roman55.1%Medium0.018163970627671163https://leetcode.com/problems/integer-to-roman
43450Delete Node in a BST43.1%Medium0.017715255135256906https://leetcode.com/problems/delete-node-in-a-bst
44126Word Ladder II22.1%Hard0.017264131849759706https://leetcode.com/problems/word-ladder-ii
45283Move Zeroes57.8%Easy0.017117843516968597https://leetcode.com/problems/move-zeroes
4617Letter Combinations of a Phone Number46.8%Medium0.016740294672744443https://leetcode.com/problems/letter-combinations-of-a-phone-number
47168Excel Sheet Column Title31.1%Easy0.01664624371778361https://leetcode.com/problems/excel-sheet-column-title
4834Find First and Last Position of Element in Sorted Array36.2%Medium0.016217667425614986https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array
49863All Nodes Distance K in Binary Tree55.4%Medium0.0161554402222852https://leetcode.com/problems/all-nodes-distance-k-in-binary-tree
50178Rank Scores45.8%Medium0.01606460250380669https://leetcode.com/problems/rank-scores
517Reverse Integer25.8%Easy0.015930950253255746https://leetcode.com/problems/reverse-integer
52242Valid Anagram56.9%Easy0.015812168558991563https://leetcode.com/problems/valid-anagram
53225Implement Stack using Queues45.1%Easy0.015760767534495523https://leetcode.com/problems/implement-stack-using-queues
54771Jewels and Stones86.4%Easy0.015520228759096881https://leetcode.com/problems/jewels-and-stones
55334Increasing Triplet Subsequence40.0%Medium0.015444322427473612https://leetcode.com/problems/increasing-triplet-subsequence
56322Coin Change35.5%Medium0.01536423539952715https://leetcode.com/problems/coin-change
57204Count Primes31.5%Easy0.01514925454347171https://leetcode.com/problems/count-primes
58215Kth Largest Element in an Array55.4%Medium0.014861874883289309https://leetcode.com/problems/kth-largest-element-in-an-array
59141Linked List Cycle41.1%Easy0.013308023070176913https://leetcode.com/problems/linked-list-cycle
60347Top K Frequent Elements61.2%Medium0.013133123243576152https://leetcode.com/problems/top-k-frequent-elements
61557Reverse Words in a String III69.8%Easy0.01311494207782801https://leetcode.com/problems/reverse-words-in-a-string-iii
62153Sum26.8%Medium0.012936791030719435https://leetcode.com/problems/3sum
6353Maximum Subarray46.5%Easy0.012896082985676302https://leetcode.com/problems/maximum-subarray
64973K Closest Points to Origin63.8%Medium0.012352613834765824https://leetcode.com/problems/k-closest-points-to-origin
6533Search in Rotated Sorted Array34.5%Medium0.012342978578758374https://leetcode.com/problems/search-in-rotated-sorted-array
6677Combinations54.7%Medium0.011908446770635425https://leetcode.com/problems/combinations
67445Add Two Numbers II54.5%Medium0.011785640248472312https://leetcode.com/problems/add-two-numbers-ii
68378Kth Smallest Element in a Sorted Matrix54.3%Medium0.011055944567589151https://leetcode.com/problems/kth-smallest-element-in-a-sorted-matrix
69232Implement Queue using Stacks49.6%Easy0.010770163342482653https://leetcode.com/problems/implement-queue-using-stacks
70207Course Schedule43.1%Medium0.010625837876226181https://leetcode.com/problems/course-schedule
71169Majority Element58.7%Easy0.01012609912610397https://leetcode.com/problems/majority-element
72746Min Cost Climbing Stairs50.3%Easy0.00942958425029653https://leetcode.com/problems/min-cost-climbing-stairs
73184Sum33.7%Medium0.009345862418237686https://leetcode.com/problems/4sum
7442Trapping Rain Water48.9%Hard0.009245058144051103https://leetcode.com/problems/trapping-rain-water
7532Longest Valid Parentheses28.4%Hard0.008806750006418186https://leetcode.com/problems/longest-valid-parentheses
7620Valid Parentheses39.0%Easy0.008761898231759775https://leetcode.com/problems/valid-parentheses
774Median of Two Sorted Arrays29.6%Hard0.00834419823769013https://leetcode.com/problems/median-of-two-sorted-arrays
78394Decode String50.0%Medium0.0077851697215559675https://leetcode.com/problems/decode-string
79175Combine Two Tables60.8%Easy0.007374664691267215https://leetcode.com/problems/combine-two-tables
80240Search a 2D Matrix II43.2%Medium0.007279377002901276https://leetcode.com/problems/search-a-2d-matrix-ii
81176Second Highest Salary31.6%Easy0.007097261870761636https://leetcode.com/problems/second-highest-salary
821108Defanging an IP Address87.5%Easy0.0070151111959223245https://leetcode.com/problems/defanging-an-ip-address
83680Valid Palindrome II36.6%Easy0.0069674554638543594https://leetcode.com/problems/valid-palindrome-ii
84509Fibonacci Number67.2%Easy0.0068213088507380355https://leetcode.com/problems/fibonacci-number
85114Flatten Binary Tree to Linked List49.3%Medium0.00661815784247808https://leetcode.com/problems/flatten-binary-tree-to-linked-list
86448Find All Numbers Disappeared in an Array55.9%Easy0.006552029991300186https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array
879Palindrome Number48.4%Easy0.006530753927898854https://leetcode.com/problems/palindrome-number
8888Merge Sorted Array39.4%Easy0.006480904084083141https://leetcode.com/problems/merge-sorted-array
89104Maximum Depth of Binary Tree66.0%Easy0.006002018684998332https://leetcode.com/problems/maximum-depth-of-binary-tree
903Longest Substring Without Repeating Characters30.4%Medium0.005927699633275225https://leetcode.com/problems/longest-substring-without-repeating-characters
9176Minimum Window Substring34.6%Hard0.005927699633275225https://leetcode.com/problems/minimum-window-substring
9278Subsets62.0%Medium0.005864474528481365https://leetcode.com/problems/subsets
93105Construct Binary Tree from Preorder and Inorder Traversal48.8%Medium0.005399581153465832https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal
94237Delete Node in a Linked List63.8%Easy0.004902571407932664https://leetcode.com/problems/delete-node-in-a-linked-list
95260Single Number III64.3%Medium0.004544085371366539https://leetcode.com/problems/single-number-iii
96236Lowest Common Ancestor of a Binary Tree45.7%Medium0.004507557778555423https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree
97560Subarray Sum Equals K43.9%Medium0.00407664649376343https://leetcode.com/problems/subarray-sum-equals-k
98387First Unique Character in a String53.4%Easy0.003992021269537453https://leetcode.com/problems/first-unique-character-in-a-string
99103Binary Tree Zigzag Level Order Traversal48.3%Medium0.0037942709938308134https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal
10028Implement strStr()34.5%Easy0.0037760830292959675https://leetcode.com/problems/implement-strstr
10179Word Search35.6%Medium0.003688528772102895https://leetcode.com/problems/word-search
102102Binary Tree Level Order Traversal54.6%Medium0.0034812915925119536https://leetcode.com/problems/binary-tree-level-order-traversal
10356Merge Intervals39.3%Medium0.0033129067901687907https://leetcode.com/problems/merge-intervals
104122Best Time to Buy and Sell Stock II57.0%Easy0.0032333711784785267https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii
10598Validate Binary Search Tree27.8%Medium0.00280761046364743https://leetcode.com/problems/validate-binary-search-tree
106121Best Time to Buy and Sell Stock50.5%Easy0.0020383211296970956https://leetcode.com/problems/best-time-to-buy-and-sell-stock