For example, take the array [5, 5, 10, 100, 10, 5]. We can solve this problem by defining two variables: excl , which represents the maximum sum without including the previous element, and incl , which denotes the maximum sum including the previous element. We start by initializing excl to 0 and incl to the value of the first element in the array. Next, we will iterate through the array beginning with the second element. For each element, we calculate new_excl as the maximum of the previous excl and incl , since we are not including the current element. We then update incl to be excl plus the current element, as we are including it. Afterward, we set excl to new_excl . This way, at each step, we decide whether to exclude the current element and take the maximum of the previous sums, or to include the current element while excluding the previous one. In this scenario, the maximum sum of non-adjacent elements will be 110.