Skip to main content
deleted 8 characters in body
Source Link

Jelly, 17 12 11 bytes

ẆmþJẎ“£uƇ»e

Try it online!

-5 bytes by adapting emanresu A's approach
-1 byte thanks to ovs!

How it works \$\le\$

ẆmþJẎ“£uƇ»e - Main link. Takes a word W on the left
Ẇ           - Contiguous substrings S of W
   J        - Yield the range 1 ≤ i ≤ len(W)
  þ         - For each pair (S, i):
 m          -   Take the ith elements of s
    Ẏ       - Tighten into a list of strings
     “£uƇ»  - Compressed string; "nice"
          e - Is this in the list of strings?

Jelly, 17 12 11 bytes

ẆmþJẎ“£uƇ»e

Try it online!

-5 bytes by adapting emanresu A's approach
-1 byte thanks to ovs!

How it works \$\le\$

ẆmþJẎ“£uƇ»e - Main link. Takes a word W on the left
Ẇ           - Contiguous substrings S of W
   J        - Yield the range 1 ≤ i ≤ len(W)
  þ         - For each pair (S, i):
 m          -   Take the ith elements of s
    Ẏ       - Tighten into a list of strings
     “£uƇ»  - Compressed string; "nice"
          e - Is this in the list of strings?

Jelly, 17 12 11 bytes

ẆmþJẎ“£uƇ»e

Try it online!

-5 bytes by adapting emanresu A's approach
-1 byte thanks to ovs!

How it works

ẆmþJẎ“£uƇ»e - Main link. Takes a word W on the left
Ẇ           - Contiguous substrings S of W
   J        - Yield the range 1 ≤ i ≤ len(W)
  þ         - For each pair (S, i):
 m          -   Take the ith elements of s
    Ẏ       - Tighten into a list of strings
     “£uƇ»  - Compressed string; "nice"
          e - Is this in the list of strings?
added 60 characters in body
Source Link

Jelly, 17 1212 11 bytes

ẆµmJ)Ẏ“£uƇ»eẆmþJẎ“£uƇ»e

Try it online!Try it online!

-5 bytes by adapting emanresu A's approach
-1 byte thanks to ovs!

How it works \$\le\$

ẆµmJ)Ẏ“£uƇ»eẆmþJẎ“£uƇ»e - Main link. Takes a word W on the left
Ẇ            - Contiguous substrings S of W
 µ  )J        - Over eachYield substringthe S:
range 1  Ji  len(W)
  þ     -   Yield the- rangeFor [1,each ...,pair len(S, i)]:
  m          -   For each i in the range, takeTake the ith elements of s
     Ẏ       - Tighten into a list of strings
      “£uƇ»  - Compressed string; "nice"
           e - Is this in the list of strings?

Jelly, 17 12 bytes

ẆµmJ)Ẏ“£uƇ»e

Try it online!

-5 bytes by adapting emanresu A's approach

How it works

ẆµmJ)Ẏ“£uƇ»e - Main link. Takes a word W on the left
Ẇ            - Contiguous substrings of W
 µ  )        - Over each substring S:
   J         -   Yield the range [1, ..., len(S)]
  m          -   For each i in the range, take the ith elements of s
     Ẏ       - Tighten into a list of strings
      “£uƇ»  - Compressed string; "nice"
           e - Is this in the list of strings?

Jelly, 17 12 11 bytes

ẆmþJẎ“£uƇ»e

Try it online!

-5 bytes by adapting emanresu A's approach
-1 byte thanks to ovs!

How it works \$\le\$

ẆmþJẎ“£uƇ»e - Main link. Takes a word W on the left
Ẇ           - Contiguous substrings S of W
   J        - Yield the range 1  i  len(W)
  þ         - For each pair (S, i):
 m          -   Take the ith elements of s
    Ẏ       - Tighten into a list of strings
     “£uƇ»  - Compressed string; "nice"
          e - Is this in the list of strings?
deleted 84 characters in body
Source Link

Jelly, 1717 12 bytes

ẹⱮ“£uƇ»ŒpIµEaAƑẆµmJ)Ẏ“£uƇ»e

Try it online!Try it online!

-5 bytes by adapting emanresu A's approach

How it works

ẹⱮ“£uƇ»ŒpIµEaAƑẆµmJ)Ẏ“£uƇ»e - Main link. Takes a word W on the left
  “£uƇ»           - Compressed string; "nice"
 Contiguous substrings of W
 µ  )        - ForOver each character c insubstring "nice"S:
   J         -   ListYield the indices of c in W
       Œp         - Cartesian product of therange lists[1, of..., indiceslen(S)]
       m  I        - Forward differences ofFor each
         i µin the range, take )the ith -elements Overof each:s
           E      - Tighten into Area thelist allof equal?strings
             “£uƇ»  -   Are they all positive? (lit: all invariant underCompressed absolutestring; value)"nice"
            a    e -   Both are true?
              Is this in -the Arelist anyof truestrings?

Jelly, 17 bytes

ẹⱮ“£uƇ»ŒpIµEaAƑ)

Try it online!

How it works

ẹⱮ“£uƇ»ŒpIµEaAƑ) - Main link. Takes a word W on the left
  “£uƇ»           - Compressed string; "nice"
               - For each character c in "nice":
            -   List the indices of c in W
       Œp         - Cartesian product of the lists of indices
         I        - Forward differences of each
          µ    )  - Over each:
           E      -   Are the all equal?
               -   Are they all positive? (lit: all invariant under absolute value)
            a     -   Both are true?
                 - Are any true?

Jelly, 17 12 bytes

ẆµmJ)Ẏ“£uƇ»e

Try it online!

-5 bytes by adapting emanresu A's approach

How it works

ẆµmJ)Ẏ“£uƇ»e - Main link. Takes a word W on the left
            - Contiguous substrings of W
 µ  )        - Over each substring S:
   J         -   Yield the range [1, ..., len(S)]
  m          -   For each i in the range, take the ith elements of s
            - Tighten into a list of strings
      “£uƇ»  - Compressed string; "nice"
           e - Is this in the list of strings?
added 621 characters in body
Source Link
Loading
Source Link
Loading