Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

322
Views
subcadena común más larga Entrada múltiple en JS
function LCSubStr(X, Y) { let m = X.length; let n = Y.length; let result = 0; let end; let len = new Array(4); for (let i = 0; i < len.length; i++) { len[i] = new Array(n); for (let j = 0; j < n; j++) { len[i][j] = 0; } } let currRow = 0; for (let i = 0; i <= m; i++) { for (let j = 0; j <= n; j++) { if (i == 0 || j == 0) { len[currRow][j] = 0; } else if (X[i - 1] == Y[j - 1]) { len[currRow][j] = len[1 - currRow][j - 1] + 1; if (len[currRow][j] > result) { result = len[currRow][j]; end = i - 1; } } else { len[currRow][j] = 0; } } currRow = 1 - currRow; } if (result == 0) { return "-1"; } return X.substr(end - result + 1, result); } // Driver Code let X = "GeeksforGeeks"; let Y = "GeeksQuiz"; // function call document.write(LCSubStr(X, Y));

¿Cómo puedo convertir este código para entrada múltiple?

Revisé muchos códigos lcs pero nadie trabaja con

ABCQEFDEFGHIJ BCXEFGYZBCDEWEFGHU > EFGH

Este simplemente funciona bien sin ningún problema. Debería convertir este para entrada múltiple en Javascript.

Ahora tenemos X, Y pero debería ser con múltiples entradas.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!