Problem 1856. Molecule Atomic Wt (CHONS) Molecules
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
Dyuman Joshi
on 8 Feb 2022
Update: Test suite has been enhanced to include double digit numbers.
Solution Comments
Show commentsProblem Recent Solvers46
Suggested Problems
-
329 Solvers
-
Number of 1s in a binary string
8567 Solvers
-
Compute a dot product of two vectors x and y
977 Solvers
-
334 Solvers
-
Find out missing number from a vector of 9 elements
293 Solvers
More from this Author308
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!