public class Solution { public int[] Decode(int[] encoded, int first) { var list = new List<int>(); var hidden = first; list.Add(hidden); foreach (var enc in encoded) { hidden ^= enc; list.Add(hidden); } return list.ToArray(); } }Source: https://leetcode.com/problems/decode-xored-array/
No comments:
Post a Comment