Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fix AvoidHairpins to search within last window

See original GitHub issue

I noticed that the AvoidHairpins specification does not search for hairpins within the last window. Intuitively, if I set my window size to be the same as my sequence length, the algorithm should find every hairpin in the sequence. In reality, though, this algorithm will not find any hairpins.

Here is some updated pseudocode that I briefly tested, it seems to be working:

for i in range(len(sequence) - stem_size:
    word = sequence[i : i + stem_size]
    if len(sequence) - i < window:
        window = len(sequence) - i
    if stem_size > window / 2:
    rest = reverse[-(i + window) : -(i + stem_size)]
    if word in rest:
        // follow existing algorithm

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

Zulkocommented, Jun 11, 2020

Thanks, it looks like you were right and you had the right fix (the mistake was to stop at i-hairpin_window instead of i-stem-size). I went ahead and pushed a commit to master which applies the fix (and a test for it) to save you a few clicks @veghp ! @NikashS let us know how it works for you.

prusnakcommented, Jan 2, 2021

I think this issue should be closed (as per comment above).

Read more comments on GitHub >

github_iconTop Results From Across the Web

These Hair Pins Are the Secret to Effortlessly Chic Updos
One Vogue editor breaks down why U-shaped hair pins are the secret to effortlessly chic hair at home and beyond.
Read more >
How to Pick a Lock with a Bobby Pin - YouTube
Locked out? Or maybe you've always wondered how they do it in the movies? This quick video will give you some tips on...
Read more >
Are Claw Clips Better for Thinning Hair? - Revela
They help prevent the heavy tugging and breakage that comes with putting hair up in a ponytail or pulled back with a headband....
Read more >
How to wear hair clips like a cool girl
Hair clips can help in the styling process and compliment the bride's overall wedding look seamlessly. The best part is a bridal hair...
Read more >
How to Open a Locked Door with a Bobby Pin - wikiHow
1. Open up a bobby pin and bend it at a 90-degree angle. Spread the wavy and straight ends of the bobby pin...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found