Ad
  • Custom User Avatar

    The if (slen < eLen) checks whether the ending string is longer than the str. If it is, it's impossible for str to end with ending, because a shorter string cannot contain a longer suffix. This is a necessary optimization that saves computation time by immediately returning false in such cases.

    You are correct in observing that this condition indirectly accounts for empty strings, but its main purpose is to enforce a size constraint for the suffix check.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    That doesn't matter. Just passing the test matters.

  • Custom User Avatar

    Iterating over bytes, or runes, doesn't matter here. This logic does in fact work in other languages, because I used this logic in other languages to solve this, such as C#, JavaScript, Python, and Ruby.

    Go be cancerous somewhere else.

  • Custom User Avatar

    Correct. However, you will see a lot of wtf stuff at 8 kyu when the person is new lol.

  • Custom User Avatar
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Some kind of issue with TypeScript.

    TSError: ⨯ Unable to compile TypeScript:
    test.ts:3:27 - error TS2306: File '/workspace/default/solution.ts' is not a module.

    3 import solution = require('./solution');
    ~~~~~~~~~~~~
    test.ts:1:22 - error TS6053: File '/runner/typings/mocha/index.d.ts' not found.

    1 ///
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    test.ts:2:22 - error TS6053: File '/runner/typings/chai/index.d.ts' not found.

    2 ///
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    at createTSError (/workspace/default/node_modules/.pnpm/ts-node@10.9.1_ewfw2lwfc3dwdvz7r6yz2ssqyi/node_modules/ts-node/src/index.ts:859:12)
    at reportTSError (/workspace/default/node_modules/.pnpm/ts-node@10.9.1_ewfw2lwfc3dwdvz7r6yz2ssqyi/node_modules/ts-node/src/index.ts:863:19)
    at getOutput (/workspace/default/node_modules/.pnpm/ts-node@10.9.1_ewfw2lwfc3dwdvz7r6yz2ssqyi/node_modules/ts-node/src/index.ts:1077:36)
    at Object.compile (/workspace/default/node_modules/.pnpm/ts-node@10.9.1_ewfw2lwfc3dwdvz7r6yz2ssqyi/node_modules/ts-node/src/index.ts:1433:41)
    at Module.m._compile (/workspace/default/node_modules/.pnpm/ts-node@10.9.1_ewfw2lwfc3dwdvz7r6yz2ssqyi/node_modules/ts-node/src/index.ts:1617:30)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Object.require.extensions.<computed> [as .ts] (/workspace/default/node_modules/.pnpm/ts-node@10.9.1_ewfw2lwfc3dwdvz7r6yz2ssqyi/node_modules/ts-node/src/index.ts:1621:12)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Function.Module._load (node:internal/modules/cjs/loader:878:12)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.exports.requireOrImport (/workspace/default/node_modules/.pnpm/mocha@10.2.0/node_modules/mocha/lib/nodejs/esm-utils.js:53:16)
    at async Object.exports.loadFilesAsync (/workspace/default/node_modules/.pnpm/mocha@10.2.0/node_modules/mocha/lib/nodejs/esm-utils.js:100:20)
    at async singleRun (/workspace/default/node_modules/.pnpm/mocha@10.2.0/node_modules/mocha/lib/cli/run-helpers.js:125:3)
    at async Object.exports.handler (/workspace/default/node_modules/.pnpm/mocha@10.2.0/node_modules/mocha/lib/cli/run.js:370:5)
    
  • Custom User Avatar

    I think that was it. My solution is wrong, but the output in the test is no longer truncated. Thanks!

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Kata that lacks meaningful test shouldn't be pushed through. This was JavaScript.

    expected '0.1.2.2.3.2.3.4.3.5.3.6.7.4.8.3.7.9.7…' to equal '0.1.2.2.3.2.3.4.3.5.3.6.7.4.8.3.7.9.7…'

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Loading more items...