question_id int64 39 56.8k | question_title stringlengths 3 54 | question_content stringlengths 88 4.02k | dataset stringclasses 1
value | difficulty stringclasses 3
values | java dict | java15 dict | java8 dict | python dict | test_cases stringlengths 28 4.02M | max_retries float64 1 3 ⌀ |
|---|---|---|---|---|---|---|---|---|---|---|
16,725 | Beautiful Strings | You are given a string, $S$, consisting of lowercase English letters.
A string is *beautiful* with respect to $S$ if it can be derived from $S$ by removing *exactly* $2$ characters.
Find and print the number of different strings that are *beautiful* with respect to $S$. | hackerrank | Hard | {
"class_name": "Result",
"func_sign": [
"public static long beautifulStrings(String s)"
],
"script_name": "Solution",
"solution": "import java.io.*;\nimport java.math.BigInteger;\nimport java.util.*;\n\n\n\npublic class B\n{\n String line;\n StringTokenizer inputParser;\n BufferedReader is;\n ... | {
"solution": "import java.io.*;\n\npublic class Solution {\n \n static long beautifulStrings(char[] s) {\n long result = 0;\n int res[] = new int[s.length];\n for (int j = s.length-1; j > 0; j--) {\n res[j-1] = res[j];\n if ((j > 1) && (s[j] == s[j-1])) {\n continue;... | {
"solution": "import java.io.*;\nimport java.util.*;\n\npublic class Solution {\n private static InputReader in;\n private static PrintWriter out;\n\n public static void main(String[] args) throws IOException {\n in = new InputReader(System.in);\n out = new PrintWriter(System.out, true);\n\n char[] c = i... | {
"class_name": null,
"func_sign": [
"beautifulStrings(s)"
],
"solution": "import operator as op\nimport functools\n\n \ndef ncr(n, r):\n if n < r: return 0\n r = min(r, n-r)\n if r == 0: return 1\n numer = functools.reduce(op.mul, range(n, n-r, -1))\n denom = functools.reduce(op.mul, ... | eJzt2duO5za23/FcBMgj5LZR10Zgz3gOnicJkAkGJEWKlCjxJFISBwbyEHmvvFLW3xgEgTecqyB7Z/D99A8Nt6u6Sgdyca3q//bv//N//B//4d/9l79/hTP36+sv376UVdWsizusev56fn337cs+2ZrLLn9L/frHJ/3xD18/f/ftf/tbd9dWn/G2aRpz19/8iz/98Ku/OHqO/Tc//Yfvf/Xp7/rM9zG3a0ONeZv9VTnm5+y1XT6XqM/W1urSVl2v6UzzbWPfvS2bXmp7bx+CurK1KchNhl1d1TQzt+jMLVeyP662p9jF2Bq2au2497oc... | null |
2,186 | Travel around the world | "\n\n\nThere are N cities and N directed roads in Steven's world. The cities are numbered from 0 to (...TRUNCATED) | hackerrank | Medium | {"class_name":"Result","func_sign":["public static int travelAroundTheWorld(List<Integer> a, List<In(...TRUNCATED) | {"solution":"import java.io.*;\nimport java.math.*;\nimport java.security.*;\nimport java.text.*;\ni(...TRUNCATED) | {"solution":"import java.io.*;\nimport java.util.*;\n\npublic class Solution {\n\n public static (...TRUNCATED) | {"class_name":null,"func_sign":["travelAroundTheWorld(a, b, c)"],"solution":"#!/usr/bin/env python3\(...TRUNCATED) | "eJysvUmOLOuSnFkD1j4Mb8zB3zdcCQFeoAbFHHByKweZAAGCQO2lVlG7K/lEzT28MY+I84oZfOC550R4mP2NNqKiov/3f/jP/+/(...TRUNCATED) | null |
19,667 | Longest Palindromic Subsequence | "Steve loves playing with palindromes. He has a string, $s$, consisting of $n$ lowercase English alp(...TRUNCATED) | hackerrank | Hard | {"class_name":"Result","func_sign":["public static int longestPalindromicSubsequence(String s, int k(...TRUNCATED) | {"solution":"import java.io.*;\nimport java.util.*;\nimport java.text.*;\nimport java.math.*;\nimpor(...TRUNCATED) | {"solution":"\nimport java.util.Scanner;\n\n/**\n *\n * @author abhishek\n */\npublic class LongestP(...TRUNCATED) | {"class_name":null,"func_sign":["longestPalindromicSubsequence(s, k)"],"solution":"#!/bin/python3\n\(...TRUNCATED) | "eJzsvdnOJUmWndcX0nsE6poXGUNWRulJBCgAweZ5no0goJfQPfmigpb9RYrNaqq6kywS3WQcz0REnNHdbO+1v+VuZv5//S//9//(...TRUNCATED) | null |
2,529 | Swap Permutation | "You are given an array _A = [1, 2, 3, ..., n]_: \n\n1. How many sequences _(S<sub>1</sub>)_ can(...TRUNCATED) | hackerrank | Medium | {"class_name":"Result","func_sign":["public static List<Integer> swapPermutation(int n, int k)"],"sc(...TRUNCATED) | {"solution":"import java.io.*;\nimport java.math.*;\nimport java.security.*;\nimport java.security.*(...TRUNCATED) | {"solution":"import java.io.*;\nimport java.util.Arrays;\n\npublic class Solution {\n\n final sta(...TRUNCATED) | {"class_name":null,"func_sign":["swapPermutation(n, k)"],"solution":"from itertools import accumulat(...TRUNCATED) | "eJyVkT0KAjEQRgU9yJB6kczkx40nEVQsdAubdYtdEETwEHooO49kWCyEzFdsqkDefPMy81i8PvPZeDbvfNnezLntht6syTCxqcg(...TRUNCATED) | 2 |
2,113 | Extremum Permutations | "\n\n\nLet's consider a permutation _P = {p<sub>1</sub>, p<sub>2</sub>, ..., p<sub>N</sub>}_ of the (...TRUNCATED) | hackerrank | Medium | {"class_name":"Result","func_sign":["public static int extremumPermutations(int n, List<Integer> a, (...TRUNCATED) | {"solution":"import java.io.*;\nimport java.util.*;\nimport java.text.*;\nimport java.math.*;\nimpor(...TRUNCATED) | {"solution":"\n\nimport java.io.File;\nimport java.io.FileNotFoundException;\nimport java.util.Scann(...TRUNCATED) | {"class_name":null,"func_sign":["extremumPermutations(n, a, b)"],"solution":"# from sets import Set\(...TRUNCATED) | "eJyNmc2qZVkRhB34INsCZ42s/8zlkwhecaA1cHLtQTU0iOBD6PsaX+QpcKByGoq+devstXNlRkZE5vnHL//1w69+4f9+92v98Pu(...TRUNCATED) | null |
82 | Square Subsequences | "**Square Subsequences**\n\nA string is called a square string if it can be obtained by concatenatin(...TRUNCATED) | hackerrank | Hard | {"class_name":"Result","func_sign":["public static int squareSubsequences(String s)"],"script_name":(...TRUNCATED) | {"solution":"import java.io.*;\nimport java.util.*;\n\npublic class Solution implements Runnable {\n(...TRUNCATED) | {"solution":"import java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.Buffered(...TRUNCATED) | {"class_name":null,"func_sign":["squareSubsequences(s)"],"solution":"\ndef count_square_subsequences(...TRUNCATED) | "eJzdu0mOZcm6nacGB/Jw24TgZbi7RiJAQRBW13VthAANQhoMexya1o6rB5D33eyoIYH0iMw8fs7Zldn/r/Ut2zv/j3/3f/2Xr//(...TRUNCATED) | null |
1,197 | Modify The Sequence | "You are given a sequence of integers a<sub>1</sub>,a<sub>2</sub>,a<sub>3</sub>.....a<sub>n</sub>. Y(...TRUNCATED) | hackerrank | Hard | {"class_name":"Result","func_sign":["public static int modifySequence(List<Integer> arr)"],"script_n(...TRUNCATED) | {"solution":"import java.io.*;\nimport java.util.*;\n\npublic class Solution {\n \n static int c(...TRUNCATED) | {"solution":"import java.io.*;\nimport java.util.*;\n\npublic class Solution {\n\n public static (...TRUNCATED) | {"class_name":null,"func_sign":["modifySequence(arr)"],"solution":"import bisect\n\ndef parse(seq):\(...TRUNCATED) | "eJzt2d2KI0eagOGBnQsJdNws8ZPxk76ShanFLHYd+ETug2owGMNcxNzk3sV8smWloLL6zOBdP56R9D4pKTIyMlvVpf7n3//rf/7(...TRUNCATED) | null |
19,176 | Longest Mod Path | "In the middle of a nightmare, [Maxine](http://life-is-strange.wikia.com/wiki/Maxine_Caulfield) sudd(...TRUNCATED) | hackerrank | Hard | {"class_name":"Result","func_sign":["public static List<Integer> longestModPath(List<List<Integer>> (...TRUNCATED) | {"solution":"import java.io.*;\nimport java.math.*;\nimport java.text.*;\nimport java.util.*;\nimpor(...TRUNCATED) | {"solution":"import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\(...TRUNCATED) | {"class_name":null,"func_sign":["longestModPath(corridor, queries)"],"solution":"\nfrom math import (...TRUNCATED) | "eJx0vcuuNkuWZUUD3mMr29Vwc7vzJEgciQZkg05QjSyppBISj84cY/k+cU6mMioD4v/2d3E3N1vXueb8//7n/+2/P//L//S//49(...TRUNCATED) | null |
76 | Lucky Numbers | "A number is called *lucky* if the sum of its digits, as well as the sum of the squares of its digit(...TRUNCATED) | hackerrank | Hard | {"class_name":"Result","func_sign":["public static long luckyNumbers(long a, long b)"],"script_name"(...TRUNCATED) | {"solution":"import java.io.*;\nimport java.math.*;\nimport java.text.*;\nimport java.util.*;\nimpor(...TRUNCATED) | {"solution":"import java.io.*;\nimport java.util.*;\n\npublic class LuckyNumbers {\n private clas(...TRUNCATED) | {"class_name":null,"func_sign":["luckyNumbers(a, b)"],"solution":"def lucky(N):\n p = [int(x) for(...TRUNCATED) | "eJyUvc2uLEmSpMfF8D0ctSRm4fbvzichwAK4mOkFN8UB2AMQIAjw0SnfZ5HNmjTPATq7K/PGPXEi3NzNVEVVRUX/3//wv/yf/9P(...TRUNCATED) | null |
779 | Oil Well | "Mr. Road Runner bought a piece of land in the middle of a desert for a nominal amount. It turns out(...TRUNCATED) | hackerrank | Hard | {"class_name":"Result","func_sign":["public static int oilWell(List<List<Integer>> blocks)"],"script(...TRUNCATED) | {"solution":"import java.io.*;\nimport java.util.*;\nimport java.text.*;\nimport java.math.*;\nimpor(...TRUNCATED) | {"solution":"import java.io.*;\nimport java.util.*;\n\npublic class Solution {\n static int[][][](...TRUNCATED) | {"class_name":null,"func_sign":["oilWell(blocks)"],"solution":"r, c = list(map(int, input().strip().(...TRUNCATED) | "eJztnc9u20YQxnvIgyx0DopdirKlPkmB/smh9aGXNAcHCFAEyEOkh75tE5kiZ775Zkk1tRE4nwnLFrk7v/m3s8u1ZH148ffdP9+(...TRUNCATED) | null |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 11