Dataset Viewer
Auto-converted to Parquet Duplicate
question
stringlengths
142
9.56k
solutions
stringlengths
2
867k
starter_code
stringlengths
0
1.47k
input_output
stringlengths
29
74M
difficulty
stringclasses
5 values
raw_tags
stringlengths
2
276
name
stringclasses
503 values
source
stringclasses
9 values
tags
stringlengths
2
171
skill_types
stringclasses
114 values
url
stringlengths
36
165
Expected Auxiliary Space
stringclasses
179 values
time_limit
stringclasses
57 values
date
stringclasses
638 values
picture_num
stringclasses
7 values
memory_limit
stringclasses
12 values
Expected Time Complexity
stringclasses
337 values
Given a string 's'. The task is to find the smallest window length that contains all the characters of the given string at least one time. For eg. A = aabcbcdbca, then the result would be 4 as of the smallest window will be dbca. Example 1: Input : "AABBBCBBAC" Output : 3 Explanation : Sub-string -> "BAC" Example 2: ...
["class Solution:\n\n\tdef findSubString(self, str):\n\t\tdict = {}\n\t\tans = float('inf')\n\t\tj = 0\n\t\tfor i in str:\n\t\t\tif i not in dict:\n\t\t\t\tdict[i] = 0\n\t\tlength = len(dict)\n\t\tfor i in range(len(str)):\n\t\t\tdict[str[i]] += 1\n\t\t\tif dict[str[i]] == 1:\n\t\t\t\tlength -= 1\n\t\t\twhile length ==...
#User function Template for python3 class Solution: def findSubString(self, str): # Your code goes here
{"inputs": ["\"AABBBCBBAC\"", "\"aaab\"", "\"GEEKSGEEKSFOR\""], "outputs": ["3", "2", "8"]}
MEDIUM
['Algorithms', 'Hash', 'sliding-window', 'Strings', 'Data Structures', 'Arrays']
null
geeksforgeeks
['String algorithms', 'Data structures', 'Amortized analysis']
['Amortized analysis', 'Data structures']
https://practice.geeksforgeeks.org/problems/smallest-distant-window3132/1
O(256)
null
null
0
null
O(256.N)
Given an array arr[] which contains data of N nodes of Complete Binary tree in level order fashion. The task is to print the level order traversal in sorted order. Example 1: Input: N = 7 arr[] = {7 6 5 4 3 2 1} Output: 7 5 6 1 2 3 4 Explanation: The formed Binary Tree is: 7 / \ 6 ...
["class Solution:\n\n\tdef binTreeSortedLevels(self, arr, n):\n\t\tli = []\n\t\ti = 0\n\t\tlevel = 0\n\t\twhile i < n:\n\t\t\tdumm = []\n\t\t\tif level == 0:\n\t\t\t\tli.append([arr[i]])\n\t\t\t\ti += 1\n\t\t\t\tlevel += 1\n\t\t\telse:\n\t\t\t\tsize = 2 ** level\n\t\t\t\tif i + size < n:\n\t\t\t\t\tdumm.extend(arr[i:i ...
class Solution: def binTreeSortedLevels (self,arr, n): #code here.
{"inputs": ["N = 7\narr[] = {7 6 5 4 3 2 1}", "N = 6\narr[] = {5 6 4 9 2 1}"], "outputs": ["7\n5 6\n1 2 3 4", "5\n4 6\n1 2 9"]}
MEDIUM
['Algorithms', 'Tree', 'Sorting', 'Queue', 'Data Structures', 'priority-queue']
null
geeksforgeeks
['Tree algorithms', 'Sorting', 'Data structures']
['Sorting', 'Data structures']
https://practice.geeksforgeeks.org/problems/print-binary-tree-levels-in-sorted-order3241/1
O(N).
null
null
0
null
O(NlogN).
You are given the prices of stock for n number of days. every ith day tell the price of the stock on that day.find the maximum profit that you can make by buying and selling stock any number of times as you can't proceed with other transactions if you hold any transaction. Example: Input: n = 7 prices = [1,2,3,4,5,6,7]...
["class Solution:\n\n\tdef maximumProfit(self, prices, n):\n\t\tn = len(prices)\n\t\tcurr = [0 for i in range(2)]\n\t\tnex = [0 for i in range(2)]\n\t\tprofit = 0\n\t\tfor ind in range(n - 1, -1, -1):\n\t\t\tfor buy in range(0, 2):\n\t\t\t\tif buy:\n\t\t\t\t\tbuynow = -prices[ind] + nex[0]\n\t\t\t\t\tnotbuy = 0 + nex[1...
#User function Template for python3 class Solution: def maximumProfit(self, prices, n): #Code here
{"inputs": ["n = 7\nprices = [1,2,3,4,5,6,7]"], "outputs": ["6"]}
MEDIUM
[]
null
geeksforgeeks
[]
[]
https://practice.geeksforgeeks.org/problems/buy-stock-2/1
O(n^{2})
null
null
0
null
O(n)
When little Petya grew up and entered the university, he started to take part in АСМ contests. Later he realized that he doesn't like how the АСМ contests are organised: the team could only have three members (and he couldn't take all his friends to the competitions and distribute the tasks between the team members eff...
["from sys import stdin, stdout\nfrom collections import deque\nimport sys\nfrom copy import deepcopy\nimport math\nimport collections\nfrom itertools import combinations\n\ndef check(temp):\n\tfor i in range(len(temp)):\n\t\tfor j in range(i + 1, len(temp)):\n\t\t\tif temp[i] in enemy:\n\t\t\t\tif temp[j] in enemy[tem...
{"inputs": ["7 6\nAlena\nOlya\nVanya\nBrus\nJohn\nAlice\nMariana\nAlena John\nAlena Alice\nOlya John\nOlya Alice\nVanya John\nVanya Alice\n", "7 6\nj\nZ\nPZNeTyY\nm\na\nUj\nsuaaSiKcK\nUj PZNeTyY\na j\nPZNeTyY Z\nPZNeTyY j\nm PZNeTyY\nm j\n", "15 3\na\nYclKFJoaIA\nhalYcB\nbLOlPzAeQ\ntckjt\noDFijpx\nb\npz\nVDLb\nlCEHPibt...
MEDIUM
['brute force', 'bitmasks', 'graphs']
null
codeforces
['Bit manipulation', 'Graph algorithms', 'Complete search']
['Bit manipulation', 'Complete search']
https://codeforces.com/problemset/problem/114/B
null
2.0 seconds
null
null
256.0 megabytes
null
"Consider sequences \\{A_1,...,A_N\\} of length N consisting of integers between 1 and K (inclusive)(...TRUNCATED)
"[\"(N, K) = map(int, input().split())\\nD = [0] * (K + 1)\\nD[K] = 1\\nmod = 10 ** 9 + 7\\nfor i in(...TRUNCATED)
"{\"inputs\": [\"3 2\\n\", \"3 200\\n\", \"100000 100000\\n\", \"2 1000\\n\", \"2 100000\\n\", \"2 1(...TRUNCATED)
MEDIUM
[]
AtCoder Beginner Contest 162 - Sum of gcd of Tuples (Hard)
atcoder
[]
[]
https://atcoder.jp/contests/abc162/tasks/abc162_e
null
2.0 seconds
null
null
1024.0 megabytes
null
"King Tle4Ever of Time Limit Exceeded has recently appointed Ram as his new cashier. To get this job(...TRUNCATED)
[]
{"inputs": [], "outputs": []}
MEDIUM
['Algorithms', 'Combinatorics']
computing-salary
hackerearth
['Combinatorics']
[]
null
null
null
null
null
null
null
"A gene is represented as a string of length $n$ (where $n$ is divisible by $4$), composed of the le(...TRUNCATED)
"[\"def solve(S, n):\\n\\tcount = {}\\n\\tfor c in S:\\n\\t\\tcount[c] = count.get(c, 0) + 1\\n\\tfo(...TRUNCATED)
{"inputs": ["8 \nGAAATAAA\n"], "outputs": ["5\n"]}
MEDIUM
['Algorithms - Strings']
null
hackerrank
['String algorithms']
[]
https://www.hackerrank.com/challenges/bear-and-steady-gene/problem
null
null
null
0
null
null
"Little Elephant is playing a game with arrays. He is given an array A0, A1, ..., AN−1 of N intege(...TRUNCATED)
"[\"n = int(input())\\na = list(map(int, input().split()))\\ncnt = {}\\nfor i in range(n):\\n\\tmn =(...TRUNCATED)
"{\"inputs\": [[\"5\", \"4 1 2 3 4\", \"4\", \"3\", \"4\", \"6\", \"1\", \"\", \"\"], \"5\\n4 0 2 3 (...TRUNCATED)
MEDIUM
['Algorithms', 'Constructive', 'ad-hoc', 'Brute Force', 'Stacks', 'Data Structures']
null
codechef
['Complete search', 'Constructive algorithms', 'Data structures', 'Ad-hoc']
['Data structures', 'Complete search']
https://www.codechef.com/problems/SUBMIN
null
1 seconds
2014-01-03
0
50000 bytes
null
"There is a legendary tale about Dragon Balls on Planet X: if one collects seven Dragon Balls, the D(...TRUNCATED)
[]
"{\"inputs\": [\"10 9\\n1 2 1\\n2 3 1\\n3 4 1\\n4 5 1\\n5 6 1\\n6 7 1\\n7 8 1\\n8 9 1\\n9 10 1\\n1 2(...TRUNCATED)
MEDIUM
[]
null
kattis
[]
[]
https://open.kattis.com/problems/dragonball1
null
null
null
null
null
null
"Silver Fox is fighting with N monsters.\nThe monsters are standing in a row, and we can assume them(...TRUNCATED)
"[\"(n, d, a) = map(int, input().split())\\nxh = [list(map(int, input().split())) for _ in range(n)](...TRUNCATED)
"{\"inputs\": [\"3 3 2\\n1 2\\n5 4\\n9 2\\n\", \"9 4 1\\n1 5\\n2 4\\n3 3\\n4 2\\n5 1\\n6 2\\n7 3\\n8(...TRUNCATED)
MEDIUM
[]
AtCoder Beginner Contest 153 - Silver Fox vs Monster
atcoder
[]
[]
https://atcoder.jp/contests/abc153/tasks/abc153_f
null
2.0 seconds
null
null
1024.0 megabytes
null
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
6