Given a molecular equation string determine its atomic weight.
Limited atoms of C H O N and S where wts are rounded to [12 1 16 14 32].
Example molecules and wts:
CH4 16; CH3OH 32; O2 32; C6H6 78; H2SO4 98; radical SO4 96;
Input: Molecular Eqn [string with no spaces, all Caps]
Output: Molecular Wt [approx wt]
Source: Saw this as a question on Matlab Answers.
Update: Test suite has been enhanced to include double digit numbers.
Solution Stats
Problem Comments
1 Comment
Solution Comments
Show comments
Loading...
Problem Recent Solvers48
Suggested Problems
-
2823 Solvers
-
Get the area codes from a list of phone numbers
1075 Solvers
-
Flag largest magnitude swings as they occur
692 Solvers
-
Sum the entries of each column of a matrix which satisfy a logical condition.
176 Solvers
-
Find the position of first minimum value in an integer array with numbers
185 Solvers
More from this Author306
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
Update: Test suite has been enhanced to include double digit numbers.