Added code for solving resistor problem