423. Reconstruct Original Digits from English LeetCode Solution

Minimum Cost to Merge Stones
Share:

Reconstruct Original Digits from English Given a string s containing an out-of-order English representation of digits 0-9, return the digits in ascending order.

Example 1:

Input: s = "owoztneoer"
Output: "012"

Example 2:

Input: s = "fviefuro"
Output: "45"

Constraints:

  • 1 <= s.length <= 105
  • s[i] is one of the characters ["e","g","f","i","h","o","n","s","r","u","t","w","v","x","z"].
  • s is guaranteed to be valid.

Reconstruct Original Digits from English Solutions

Time: O(n)
Space: O(n)

C++

 Will be updated Soon

Java

 
 Will be updated Soon

Python

  Will be updated Soon

Watch Tutorial

Checkout more Solutions here

Leave a Comment

Your email address will not be published. Required fields are marked *

x