Leetcode reversing Integer Explained in SAP ABAP || Algorithms and Data structures

preview_player
Показать описание
Leetcode reversing a signed Integer Explained in SAP ABAP || Algorithms and Data structures

Algorithm
Edge cases
computation complexity
Комментарии
Автор

at line no 33 it will not work when p_int = 12345, as it will return 1235 instead of 1234, so we need to declare one more variable with packed decimals and assign it back to p_int.
DATA N TYPE P DECIMALS 2.
N = ROUND( VAL = P_INT / 10 DEC = 0 MODE = 5 ).
P_INT = N.

deepeshgarg
Автор

thanks for making the video sir, why are you not making video after year 2020. I saw you haven't posted any video after that. please share your knowledge on ABAP. it will be really helpful for many people.

jamesj
Автор

PARAMETERS: p_input TYPE i.

DATA: lv_reversed TYPE i.



WHILE p_input > 0.
lv_reversed = lv_reversed * 10 + p_input MOD 10.
p_input = p_input DIV 10.
ENDWHILE.

WRITE: lv_reversed.

code-opom
Автор

why don't you assign to string and revrse it by finding length and do a substring access

janagarsundaramoorthy
join shbcf.ru