How to resolve the algorithm Determine if a string has all unique characters step by step in the BQN programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Determine if a string has all unique characters step by step in the BQN programming language
Table of Contents
Problem Statement
Given a character string (which may be empty, or have a length of zero characters):
Use (at least) these five test values (strings):
Show all output here on this page.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Determine if a string has all unique characters step by step in the BQN programming language
Source code in the bqn programming language
Check←=⌜˜
Hex←⊏⟜(∾"0A"+⟜↕¨10‿26)16{⌽𝕗|⌊∘÷⟜𝕗⍟(↕1+·⌊𝕗⋆⁼1⌈⊢)}
{
𝕊 str:
r←Check str
•Out {
∧´1=+´˘r ? "All characters are unique" ;
i←/⊏(1<+´˘r)/r
ch←(⊑i)⊑str
"'"∾ch∾"' (hex: "∾(Hex ch-@)∾", indices: "∾(•Fmt i)∾") duplicated in string '"∾str∾"'"
}
}¨⟨
""
"."
"abcABC"
"XYZ ZYX"
"1234567890ABCDEFGHIJKLMN0PQRSTUVWXYZ"
⟩
All characters are unique
All characters are unique
All characters are unique
'X' (hex: 58, indices: ⟨ 0 7 ⟩) duplicated in string 'XYZ ZYX'
'0' (hex: 30, indices: ⟨ 9 24 ⟩) duplicated in string '1234567890ABCDEFGHIJKLMN0PQRSTUVWXYZ'
You may also check:How to resolve the algorithm Fibonacci sequence step by step in the Nanoquery programming language
You may also check:How to resolve the algorithm Empty string step by step in the Run BASIC programming language
You may also check:How to resolve the algorithm Sierpinski triangle step by step in the Oforth programming language
You may also check:How to resolve the algorithm Enumerations step by step in the Java programming language
You may also check:How to resolve the algorithm Loops/While step by step in the JavaScript programming language