I just tried my first problem on Codewars and realised: This solution feels like cheating

  • MatFi@lemmy.thias.xyz
    link
    fedilink
    arrow-up
    2
    ·
    1 year ago

    Naahh… searchsortedfirst is simply faster than other search algorithms (in this specific case). Extremely useful in many applications.It ist there because Julia cares about efficiency

    • floorjam@lemmy.worldOP
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      This helped me realize how much this aligns with my problems (and I guess the spirit of this test problem). Sometimes you have special knowledge of your data and can use much more efficient functions that are just there in Julia.