From 9e83f21925a56d878e86304d0ee0fc46b66a5b0a Mon Sep 17 00:00:00 2001 From: yashhh-23 Date: Wed, 24 Jun 2026 23:38:02 +0530 Subject: [PATCH] completed array-2 --- findnumsdisappear.java | 32 ++++++++++++++++++++++++ gameoflife.java | 56 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 findnumsdisappear.java create mode 100644 gameoflife.java diff --git a/findnumsdisappear.java b/findnumsdisappear.java new file mode 100644 index 00000000..61a4ef5c --- /dev/null +++ b/findnumsdisappear.java @@ -0,0 +1,32 @@ +// Time Complexity : O(n) +// Space Complexity : O(n) +// Did this code successfully run on Leetcode : Yes +// Any problem you faced while coding this : No +// Your code here along with comments explaining your approach: used hashset to store the elements of the array and then checked for the missing elements from 1 to n and added them to the result list. + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; + + class Solution { + public List findDisappearedNumbers(int[] nums) { + + List result = new ArrayList<>(); + HashSet set = new HashSet<>(); + int n = nums.length; + + for(int i=0; i3)){ + board[i][j] = 2; + } + } + } + + for(int i=0; i=0 && c>=0 && r