---
title: "Discussion on \"Data Structure: Arrays Exercise - Reverse A String\" | Hashnode"
description: "Discussion on \"Data Structure: Arrays Exercise - Reverse A String\". Reverse A String: 把任意input的string倒敘排列\nJavaScript:\n解法一：先把input string轉換成array，組合後再轉回string，最後return\nTime Complexity: O(n)\nfor loop會iterate整個string → O(n)\njoin會iterate整個array → O(n)\nSpace Complexity: O(n)\npush把資料一個一個放入result array → O(1)\njoin會建立新的strin..."
url: "https://hashnode.com/posts/data-structure-arrays-exercise-reverse-a-string/670654c308cbd0f40e317357"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Data Structure: Arrays Exercise - Reverse A String](https://adrienetz.hashnode.dev/data-structure-arrays-exercise-reverse-a-string?utm_source=hashnode&utm_medium=feed)

Reverse A String: 把任意input的string倒敘排列 JavaScript: 解法一：先把input string轉換成array，組合後再轉回string，最後return Time Complexity: O(n) for loop會iterate整個string → O(n) join會iterate整個array → O(n) Space Complexity: O(n) push把資料一個一個放入result array → O(1) join會建立新的strin...

Oct 9, 2024 · 3 min read · adrienetz.hashnode.dev  
Read the article

## Written by

[Adriene](https://hashnode.com/@Adriene)

@Adriene · Taipei, Taiwan

  
[View profile](https://hashnode.com/@Adriene)

Junior Backend Developer

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
