From e1ec632ffe591919edae35676153655ea6e5cc8e Mon Sep 17 00:00:00 2001 From: bhaumikmaan Date: Tue, 8 Apr 2025 17:56:12 +0530 Subject: [PATCH] Fix default complexity issue and upgraded critical dependency --- package.json | 12 +++++++++--- src/_pages/Solutions.tsx | 14 +++++++++----- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 1f593c8..0284384 100644 --- a/package.json +++ b/package.json @@ -109,7 +109,13 @@ "main": "dist-electron/main.js" } }, - "keywords": ["interview", "coding", "interview prep", "technical interview", "tool"], + "keywords": [ + "interview", + "coding", + "interview prep", + "technical interview", + "tool" + ], "author": "Interview Coder Contributors", "license": "AGPL-3.0-or-later", "description": "An invisible desktop application to help you pass your technical interviews.", @@ -170,7 +176,7 @@ "rimraf": "^6.0.1", "tailwindcss": "^3.4.15", "typescript": "^5.4.2", - "vite": "^5.1.6", + "vite": "^6.2.5", "vite-plugin-electron": "^0.28.4", "vite-plugin-electron-renderer": "^0.14.6", "wait-on": "^7.2.0" @@ -187,4 +193,4 @@ "last 1 safari version" ] } -} \ No newline at end of file +} diff --git a/src/_pages/Solutions.tsx b/src/_pages/Solutions.tsx index 019bf6f..3286366 100644 --- a/src/_pages/Solutions.tsx +++ b/src/_pages/Solutions.tsx @@ -95,15 +95,19 @@ export const ComplexitySection = ({ }) => { // Helper to ensure we have proper complexity values const formatComplexity = (complexity: string | null): string => { - if (!complexity) return "O(n) - Linear time/space complexity"; - + // Default if no complexity returned by LLM + if (!complexity || complexity.trim() === "") { + return "Complexity not available"; + } + + const bigORegex = /O\([^)]+\)/i; // Return the complexity as is if it already has Big O notation - if (complexity.match(/O\([^)]+\)/i)) { + if (bigORegex.test(complexity)) { return complexity; } - // Otherwise, add a default Big O - return `O(n) - ${complexity}`; + // Concat Big O notation to the complexity + return `O(${complexity})`; }; const formattedTimeComplexity = formatComplexity(timeComplexity);