Geeksforgeeks

Timer is Running

Given N bits to an OR - Gate find the output that will be produced.

OR - Gate Table:

1 | 1 = 1

1 | 0 = 1

0 | 1 = 1

0 | 0 = 0

**Example 1:**

**Input:**
N = 4
arr: 1 1 1 0
**Output:**
1
**Explanation:**
1 | 1 = 1
1 | 1 = 1
1 | 0 = 1
hence output is 1

**Example 2:**

**Input:**
N = 4
arr: 0 0 1 0
**Output:**
1
**Explanation:**
0 | 0 = 0
0 | 1 = 1
1 | 0 = 1
hence output is 1

**Your Task:**

You don't need to read input or print anything. Your task is to complete the function **orGate()** which takes the array arr[], its size N as input parameters and returns the output after processing OR operations on N bits.

**Expected Time Complexity: **O(N)

**Expected Space Complexity: **O(1)

**Constraints:**

1<=N<=1000

Author: akundusaltlake

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

jainshubham52535 | 529 |

Pathak1899 | 436 |

yashdip123 | 380 |

kirtidee18 | 377 |

jots62 | 351 |

kirtidee18 | 1057 |

ykaushik | 752 |

aggarwalvatsal5 | 741 |

harbilassingh | 576 |

pmr_3689 | 570 |

blackshadows | 5456 |

Ibrahim Nash | 5450 |

akhayrutdinov | 5111 |

mb1973 | 4976 |

Quandray | 4827 |

Login to report an issue on this page.