Solveagivenequationandreturnthevalueofxintheformofstring"x=#value".Theequationcontainsonly'+','-'operation,thevariablexanditscoefficient.Ifthereisnosolutionfortheequation,return"Nosolution".Ifthereareinfinitesolutionsfortheequation,return"Infinitesolutions".Ifthereisexactlyonesolutionfortheequation,weensurethatthevalueofxisaninteger.Example1:Input:"x+5-3+x=6+x-2"Output:"x=2"Example2:Input:"x=x"Output:"Infinitesolutions"Example3:Input:"2x=x"Output:"x=0"Example4:Input:"2x+3x-6x=x+2"Output:"x=-1"
求一個(gè)javascript描述的解決方案
陪伴而非守候
2019-05-25 15:52:56