Ad
  • Custom User Avatar

    Expected:

    ['27669 grams ABDECHFGJI hdFXPgjklIWiYBLDbrESoRHTZMsKpVqUnmQaONJGcfCeA VIRGJLNSYCTQPBOMFKHEWXDUA', '188 poundGJCDEAHBFIKL ABGDCFE', 'NaN grams A upHNretgTMhSPYOlCjGLobJXAcEVsDBFKZaRmqkiInQUdWfv', '32658 grams cMEIGWeZTFaAHVQXONRSCdUPKJbYDBfL'], 
    

    instead got:

    ['27669 grams ABDECHFGJI hdFXPgjklIWiYBLDbrESoRHTZMsKpVqUnmQaONJGcfCeA VIRGJLNSYCTQPBOMFKHEWXDUA', '188 poundGJCDEAHBFIKL ABGDCFE', 'TNgtVbuGSaQrYFpHXkqhmseidfjwUMKPcEvlRnoLOWZDJCBI135 pounds A upHNretgTMhSPYOlCjGLobJXAcEVsDBFKZaRmqkiInQUdWfv', '32658 grams cMEIGWeZTFaAHVQXONRSCdUPKJbYDBfL']
    

    The difference: your solution considers TNgtVbuGSaQrYFpHXkqhmseidfjwUMKPcEvlRnoLOWZDJCBI135 pounds a valid expression and replaces it with NaN grams . There is no word boundary or space between numbers 135, so it shouldn't be considered at all.

  • Custom User Avatar

    input: [ '77 ouncesBSdGPWfMQaUCNXcHRDTLnemKOjJhFZEbAgikIYlV (MALUBGISOKCbNcdaEPHeJZTRQXWFVDY) ', ...] (random test)

    Expected: ['77 ouncesBSdGPWfMQaUCNXcHRDTLnemKOjJhFZEbAgikIYlV', ...]

    Why not: [2182 gramsBSdGPWfMQaUCNXcHRDTLnemKOjJhFZEbAgikIYlV', ...] ?

    Also I see cases where x tablespoons remains the same in expected output.