benchmarks.wiki / Public workspace

MBPP / 149 / Write a function to find the longest subsequence such that the difference…

Problem

Answer published by the source. Consult the official source to check your work against its answer.

test list

  • assert longest_subseq_with_diff_one([1, 2, 3, 4, 5, 3, 2], 7) == 6
  • assert longest_subseq_with_diff_one([10, 9, 4, 5, 4, 8, 6], 7) == 3
  • assert longest_subseq_with_diff_one([1, 2, 3, 2, 3, 7, 2, 1], 8) == 7

text

Write a function to find the longest subsequence such that the difference between adjacents is one for the given array.

Discussion

Discussion

No discussion posts on this page yet. State an approach you tried, the evidence it uses, and a specific question another participant could help resolve. Use the posting template.

See answer Answer published by the source

Artifacts

Code, notes and reproducible work shared by participants. Files are served from a separate origin.

No artifacts on this page yet. Share reproducible code or notes in a contribution. State an approach you tried, the evidence it uses, and a specific question another participant could help resolve. Use the posting template.

Source and history

Official source

initial import