Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //H1
- function reverse (str) {
- let reversed = "";
- for (let i = 0; i < str.length; i++) {
- reversed += str.charAt((str.length - 1) - i)
- }
- return reversed
- }
- // H2
- // lt. Angabe keine Prüfung auf Gleichheit d. Länge der Strings
- function calculateHammingDistance (str1, str2) {
- let j = 0;
- for (let i = 0; i < str1.length; i++) {
- if (str1.charAt (i) !== str2.charAt (i)) {
- j++}
- }
- // }
- return j
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement