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

89 lines
9.6 KiB
CSV

ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
289,Game of Life,54.5%,Medium,1.9095955742703714, https://leetcode.com/problems/game-of-life
1086,High Five,79.7%,Easy,1.8728225432316814, https://leetcode.com/problems/high-five
42,Trapping Rain Water,48.9%,Hard,1.7465805642808125, https://leetcode.com/problems/trapping-rain-water
209,Minimum Size Subarray Sum,38.2%,Medium,1.3987846835630127, https://leetcode.com/problems/minimum-size-subarray-sum
780,Reaching Points,29.4%,Hard,1.0654848189471613, https://leetcode.com/problems/reaching-points
166,Fraction to Recurring Decimal,21.6%,Medium,1.042800072024958, https://leetcode.com/problems/fraction-to-recurring-decimal
1041,Robot Bounded In Circle,49.6%,Medium,0.695004191307158, https://leetcode.com/problems/robot-bounded-in-circle
387,First Unique Character in a String,53.4%,Easy,0.632243999450364, https://leetcode.com/problems/first-unique-character-in-a-string
1163,Last Substring in Lexicographical Order,33.9%,Hard,0.6115111972698513, https://leetcode.com/problems/last-substring-in-lexicographical-order
238,Product of Array Except Self,60.1%,Medium,0.6032226884679701, https://leetcode.com/problems/product-of-array-except-self
4,Median of Two Sorted Arrays,29.6%,Hard,0.5686741732514908, https://leetcode.com/problems/median-of-two-sorted-arrays
862,Shortest Subarray with Sum at Least K,24.6%,Hard,0.4965766780244703, https://leetcode.com/problems/shortest-subarray-with-sum-at-least-k
443,String Compression,41.3%,Easy,0.35323767072881695, https://leetcode.com/problems/string-compression
524,Longest Word in Dictionary through Deleting,48.4%,Medium,0.3371083689581862, https://leetcode.com/problems/longest-word-in-dictionary-through-deleting
592,Fraction Addition and Subtraction,49.0%,Medium,0.32423966818557853, https://leetcode.com/problems/fraction-addition-and-subtraction
49,Group Anagrams,56.9%,Medium,0.2956303911813633, https://leetcode.com/problems/group-anagrams
64,Minimum Path Sum,54.5%,Medium,0.26326216391582735, https://leetcode.com/problems/minimum-path-sum
532,K-diff Pairs in an Array,31.6%,Easy,0.15718558352241233, https://leetcode.com/problems/k-diff-pairs-in-an-array
706,Design HashMap,61.3%,Easy,0.1476880076475794, https://leetcode.com/problems/design-hashmap
688,Knight Probability in Chessboard,48.9%,Medium,0.14465605390747982, https://leetcode.com/problems/knight-probability-in-chessboard
121,Best Time to Buy and Sell Stock,50.5%,Easy,0.14290237960985536, https://leetcode.com/problems/best-time-to-buy-and-sell-stock
54,Spiral Matrix,34.1%,Medium,0.12572728493821236, https://leetcode.com/problems/spiral-matrix
657,Robot Return to Origin,73.5%,Easy,0.10469804461670518, https://leetcode.com/problems/robot-return-to-origin
326,Power of Three,42.1%,Easy,0.09026419332308504, https://leetcode.com/problems/power-of-three
942,DI String Match,72.6%,Easy,0.08495672247596549, https://leetcode.com/problems/di-string-match
939,Minimum Area Rectangle,51.8%,Medium,0.08361414004113359, https://leetcode.com/problems/minimum-area-rectangle
887,Super Egg Drop,27.1%,Hard,0.08054440988796595, https://leetcode.com/problems/super-egg-drop
8,String to Integer (atoi),15.4%,Medium,0.07412832776627384, https://leetcode.com/problems/string-to-integer-atoi
547,Friend Circles,58.6%,Medium,0.07408600065076033, https://leetcode.com/problems/friend-circles
1051,Height Checker,71.1%,Easy,0.06960783038095686, https://leetcode.com/problems/height-checker
460,LFU Cache,34.2%,Hard,0.06836374280939023, https://leetcode.com/problems/lfu-cache
33,Search in Rotated Sorted Array,34.5%,Medium,0.06345616594863132, https://leetcode.com/problems/search-in-rotated-sorted-array
11,Container With Most Water,50.8%,Medium,0.060358007567261264, https://leetcode.com/problems/container-with-most-water
588,Design In-Memory File System,45.9%,Hard,0.05841076215641451, https://leetcode.com/problems/design-in-memory-file-system
1395,Count Number of Teams,82.0%,Medium,0.056405927913552076, https://leetcode.com/problems/count-number-of-teams
76,Minimum Window Substring,34.6%,Hard,0.05473322196089386, https://leetcode.com/problems/minimum-window-substring
724,Find Pivot Index,44.0%,Easy,0.05428741283782842, https://leetcode.com/problems/find-pivot-index
332,Reconstruct Itinerary,36.7%,Medium,0.053921416793820044, https://leetcode.com/problems/reconstruct-itinerary
91,Decode Ways,24.7%,Medium,0.05247487679829598, https://leetcode.com/problems/decode-ways
99,Recover Binary Search Tree,39.7%,Hard,0.051264071283762605, https://leetcode.com/problems/recover-binary-search-tree
560,Subarray Sum Equals K,43.9%,Medium,0.0512021569656579, https://leetcode.com/problems/subarray-sum-equals-k
322,Coin Change,35.5%,Medium,0.04828048261319787, https://leetcode.com/problems/coin-change
119,Pascal's Triangle II,49.0%,Easy,0.04675113677738821, https://leetcode.com/problems/pascals-triangle-ii
153,Find Minimum in Rotated Sorted Array,45.1%,Medium,0.04506509646857976, https://leetcode.com/problems/find-minimum-in-rotated-sorted-array
720,Longest Word in Dictionary,48.2%,Easy,0.042695919196489414, https://leetcode.com/problems/longest-word-in-dictionary
1219,Path with Maximum Gold,65.1%,Medium,0.04111576039097048, https://leetcode.com/problems/path-with-maximum-gold
647,Palindromic Substrings,60.6%,Medium,0.040968350772541844, https://leetcode.com/problems/palindromic-substrings
722,Remove Comments,34.6%,Medium,0.04049136135473691, https://leetcode.com/problems/remove-comments
993,Cousins in Binary Tree,52.0%,Easy,0.03876454345024432, https://leetcode.com/problems/cousins-in-binary-tree
992,Subarrays with K Different Integers,48.6%,Hard,0.03700699810869683, https://leetcode.com/problems/subarrays-with-k-different-integers
200,Number of Islands,46.8%,Medium,0.03483682053721545, https://leetcode.com/problems/number-of-islands
1,Two Sum,45.6%,Easy,0.03409719244428431, https://leetcode.com/problems/two-sum
62,Unique Paths,54.1%,Medium,0.02853749186115581, https://leetcode.com/problems/unique-paths
146,LRU Cache,33.2%,Medium,0.028411001832779885, https://leetcode.com/problems/lru-cache
218,The Skyline Problem,34.6%,Hard,0.025479085300984906, https://leetcode.com/problems/the-skyline-problem
836,Rectangle Overlap,48.6%,Easy,0.024228925974379843, https://leetcode.com/problems/rectangle-overlap
1209,Remove All Adjacent Duplicates in String II,56.9%,Medium,0.02324334737232728, https://leetcode.com/problems/remove-all-adjacent-duplicates-in-string-ii
19,Remove Nth Node From End of List,35.2%,Medium,0.019074355670058666, https://leetcode.com/problems/remove-nth-node-from-end-of-list
155,Min Stack,44.5%,Easy,0.01886181109797383, https://leetcode.com/problems/min-stack
206,Reverse Linked List,62.5%,Easy,0.01453513961911317, https://leetcode.com/problems/reverse-linked-list
3,Longest Substring Without Repeating Characters,30.4%,Medium,0.01391434345649413, https://leetcode.com/problems/longest-substring-without-repeating-characters
44,Wildcard Matching,24.7%,Hard,0.013703537497261858, https://leetcode.com/problems/wildcard-matching
122,Best Time to Buy and Sell Stock II,57.0%,Easy,0.013351333174864208, https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii
120,Triangle,44.2%,Medium,0.013236460625830901, https://leetcode.com/problems/triangle
739,Daily Temperatures,63.3%,Medium,0.010032690121814417, https://leetcode.com/problems/daily-temperatures
17,Letter Combinations of a Phone Number,46.8%,Medium,0.00987716546167603, https://leetcode.com/problems/letter-combinations-of-a-phone-number
380,Insert Delete GetRandom O(1),47.5%,Medium,0.009820849864094454, https://leetcode.com/problems/insert-delete-getrandom-o1
189,Rotate Array,34.7%,Easy,0.00904437880665999, https://leetcode.com/problems/rotate-array
53,Maximum Subarray,46.5%,Easy,0.008640295679602939, https://leetcode.com/problems/maximum-subarray
253,Meeting Rooms II,45.7%,Medium,0.008079219870546493, https://leetcode.com/problems/meeting-rooms-ii
141,Linked List Cycle,41.1%,Easy,0.007843861028908454, https://leetcode.com/problems/linked-list-cycle
56,Merge Intervals,39.3%,Medium,0.007796972706004796, https://leetcode.com/problems/merge-intervals
876,Middle of the Linked List,68.4%,Easy,0.007624893975696915, https://leetcode.com/problems/middle-of-the-linked-list
16,3Sum Closest,46.0%,Medium,0.0075259057003469075, https://leetcode.com/problems/3sum-closest
118,Pascal's Triangle,52.5%,Easy,0.006749941254175012, https://leetcode.com/problems/pascals-triangle
283,Move Zeroes,57.8%,Easy,0.006480437425856766, https://leetcode.com/problems/move-zeroes
973,K Closest Points to Origin,63.8%,Medium,0.005773688094426333, https://leetcode.com/problems/k-closest-points-to-origin
237,Delete Node in a Linked List,63.8%,Easy,0.005144705881237697, https://leetcode.com/problems/delete-node-in-a-linked-list
46,Permutations,63.5%,Medium,0.004216302230139218, https://leetcode.com/problems/permutations
242,Valid Anagram,56.9%,Easy,0.004154123743115972, https://leetcode.com/problems/valid-anagram
215,Kth Largest Element in an Array,55.4%,Medium,0.003902443976931749, https://leetcode.com/problems/kth-largest-element-in-an-array
78,Subsets,62.0%,Medium,0.00368765975195334, https://leetcode.com/problems/subsets
98,Validate Binary Search Tree,27.8%,Medium,0.002943776044013381, https://leetcode.com/problems/validate-binary-search-tree
104,Maximum Depth of Binary Tree,66.0%,Easy,0.002787846801433134, https://leetcode.com/problems/maximum-depth-of-binary-tree
20,Valid Parentheses,39.0%,Easy,0.0023005704055949323, https://leetcode.com/problems/valid-parentheses
347,Top K Frequent Elements,61.2%,Medium,0.0014856636219477439, https://leetcode.com/problems/top-k-frequent-elements
50,Pow(x;n),30.3%,Medium,0.0014016892647828818, https://leetcode.com/problems/powx-n