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

26 lines
2.7 KiB
CSV

ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
706,Design HashMap,61.3%,Easy,0.1171974903999194, https://leetcode.com/problems/design-hashmap
653,Two Sum IV - Input is a BST,55.5%,Easy,0.09078846984784666, https://leetcode.com/problems/two-sum-iv-input-is-a-bst
1,Two Sum,45.6%,Easy,0.06437944929577392, https://leetcode.com/problems/two-sum
20,Valid Parentheses,39.0%,Easy,0.055983722381420686, https://leetcode.com/problems/valid-parentheses
127,Word Ladder,29.6%,Medium,0.03679590970204585, https://leetcode.com/problems/word-ladder
238,Product of Array Except Self,60.1%,Medium,0.03482987258052727, https://leetcode.com/problems/product-of-array-except-self
867,Transpose Matrix,62.8%,Easy,0.031179454774354007, https://leetcode.com/problems/transpose-matrix
17,Letter Combinations of a Phone Number,46.8%,Medium,0.027199239804368825, https://leetcode.com/problems/letter-combinations-of-a-phone-number
1290,Convert Binary Number in a Linked List to Integer,80.4%,Easy,0.023623145763435913, https://leetcode.com/problems/convert-binary-number-in-a-linked-list-to-integer
56,Merge Intervals,39.3%,Medium,0.02150990613527447, https://leetcode.com/problems/merge-intervals
921,Minimum Add to Make Parentheses Valid,73.7%,Medium,0.021425565169310254, https://leetcode.com/problems/minimum-add-to-make-parentheses-valid
5,Longest Palindromic Substring,29.5%,Medium,0.020329346568668867, https://leetcode.com/problems/longest-palindromic-substring
242,Valid Anagram,56.9%,Easy,0.016513947375674708, https://leetcode.com/problems/valid-anagram
2,Add Two Numbers,33.9%,Medium,0.015095892173467356, https://leetcode.com/problems/add-two-numbers
15,3Sum,26.8%,Medium,0.013665148419080968, https://leetcode.com/problems/3sum
200,Number of Islands,46.8%,Medium,0.011509262420590827, https://leetcode.com/problems/number-of-islands
155,Min Stack,44.5%,Easy,0.010653509851791077, https://leetcode.com/problems/min-stack
103,Binary Tree Zigzag Level Order Traversal,48.3%,Medium,0.01063025572799205, https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal
387,First Unique Character in a String,53.4%,Easy,0.009392680199054166, https://leetcode.com/problems/first-unique-character-in-a-string
49,Group Anagrams,56.9%,Medium,0.008538951314232168, https://leetcode.com/problems/group-anagrams
26,Remove Duplicates from Sorted Array,45.1%,Easy,0.007782518973063169, https://leetcode.com/problems/remove-duplicates-from-sorted-array
268,Missing Number,51.7%,Easy,0.0048804391649084865, https://leetcode.com/problems/missing-number
42,Trapping Rain Water,48.9%,Hard,0.004350670338744988, https://leetcode.com/problems/trapping-rain-water
344,Reverse String,68.5%,Easy,0.003269579502519813, https://leetcode.com/problems/reverse-string