x86-64 machine code, 1717 15 bytes
B0 41 AAE6 04 01 3C5B 4CAA 742C FA4B 3C 5A01 7614 F5F1 C675 07F5 00AA C3 Following the standard calling convention for Unix-like systems (from the System V AMD64 ABI), this takes in RDI a memory address at which to place the result, as a null-terminated byte string.
In assembly:
f: mov al, 'A'-26 # Set AL to the first letter, 'A'-26. r: stosbadd al, 'Z'+1 # Add #this Writevalue to AL to theproduce outputa string,letter. advancing the pointer. b: stosb add al, 1 # Add 1 to # Write AL to get the nextoutput letterstring, advancing the pointer. cmpsub al, 'L''K' # CompareSubtract it'K' tofrom 'L'..AL. jecmp bal, 1 # Set andflags iffrom it'scalculating equal,AL jump- back1. toCF addis 1 againiff AL is 0. cmpadc al, 'K'-'Z' # CompareAdd it(this value + CF) to 'Z'.AL. The net change is +1 or +2. jbejnz r # and if it's# lessIf thanthe orresult equalis nonzero, repeat the loop. movstosb BYTE PTR [rdi], 0 # Add a null terminator to# theWrite string. AL (0) to the retoutput string, advancing the pointer. ret # Return.